Launch an application using HTML

守給你的承諾、 提交于 2020-01-23 21:13:14

问题


I know that

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

will launch Yahoo Messenger.

can I create something like this to launch MSWord or my own application?


回答1:


Here is an explanation of what you're describing: https://stackoverflow.com/a/16586294/4500419

And here you can find the URI specifications for Microsoft Office: https://msdn.microsoft.com/en-us/library/office/dn906146.aspx#sectionSection4

So, something like

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

Would open document.docx in read-only mode in MS Word.

And here's the doc on how to register your own application to a URI scheme in Windows: https://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx




回答2:


This works also by simply naming the html file .hta which is fine if its for a local project

<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>


来源:https://stackoverflow.com/questions/30401026/launch-an-application-using-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!