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