简体   繁体   English

使用HTML启动应用程序

[英]Launch an application using HTML

I know that 我知道

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

will launch Yahoo Messenger. 将启动Yahoo Messenger。

can I create something like this to launch MSWord or my own application? 我可以创建类似的东西来启动MSWord或自己的应用程序吗?

Here is an explanation of what you're describing: https://stackoverflow.com/a/16586294/4500419 这是对您所描述内容的解释: 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 在这里,您可以找到Microsoft Office的URI规范: https : //msdn.microsoft.com/zh-cn/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. 将在MS Word中以只读模式打开document.docx。

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 这是有关如何在Windows中将自己的应用程序注册到URI方案的文档: https : //msdn.microsoft.com/zh-cn/library/aa767914%28v=vs.85%29.aspx

This works also by simply naming the html file .hta which is fine if its for a local project 这也可以通过简单地命名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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM