使用HTML启动应用程序



我知道

<a href = 'ymsgr:sendim?contactID'>Send me a message</a>

将启动Yahoo Messenger。

我可以创建这样的东西来启动MSWord或我自己的应用程序吗?

下面是你所描述的内容的解释:https://stackoverflow.com/a/16586294/4500419

你可以在这里找到Microsoft Office的URI规范:https://msdn.microsoft.com/en-us/library/office/dn906146.aspx sectionSection4

比如

ms-word:ofv|u|http://yoursite.com/document.docx

将在MS Word中以只读模式打开document.docx。

下面是关于如何在Windows中注册自己的应用程序到URI方案的文档:https://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx

只要将html文件命名为。hta就可以了,如果是本地项目的话

<html> 
<head> 
<title>Application Executer</title>
<HTA:APPLICATION ID="oMyApp"     APPLICATIONNAME="Application Executer"      BORDER="no"     CAPTION="no"    SHOWINTASKBAR="yes"     SINGLEINSTANCE="yes"    SYSMENU="yes"   SCROLL="no"     WINDOWSTATE="normal">
 <script type="text/javascript" language="javascript">
 function RunFile() {       WshShell = new ActiveXObject("WScript.Shell");      WshShell.Run("c:/windows/system32/notepad.exe", 1, false); } 
</script>
 </head>
 <body> 
    <input type="button" value="Run Notepad" onclick="RunFile();"/> 
</body> 
</html>

最新更新