在 Windows 要如何用網頁來控制呼叫執行某個 exe 檔, 這邊紀錄 Firefox 和 IE 的作法.
於 IE 呼叫執行 .exe 檔寫法 (ActiveX)
下述摘錄自此篇: How to run .exe on a Webpage
IE only
<a href="javascript:LaunchApp()">Click here to Execute your file</a> <script> function LaunchApp() { if (!document.all) { alert ("This ActiveXObject is only available for Internet Explorer"); return; } var ws = new ActiveXObject("WScript.Shell"); ws.Exec("D:\\Software\\youfile.exe"); } </script>
於 Firefox 呼叫執行 .exe 檔寫法
下述摘錄自此篇: Run .exe on a Webpage using Firefox
<a href="javascript:LaunchApp()">Click here to Execute your file</a> <script> function LaunchApp() { netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); file.initWithPath("D:\\Software\\yourfile.exe"); file.launch(); } </script>
請問遊戲橘子的Beanfun!也是這樣做的嗎
這個我就不知道了, 沒玩過~