Javascript 如何从HTML运行应用程序?

Javascript 如何从HTML运行应用程序?,javascript,html,forms,xmlhttprequest,activexobject,Javascript,Html,Forms,Xmlhttprequest,Activexobject,我正在尝试从Firefox或Chrome浏览器打开一个文件。我已经编写了以下代码,它正在从Internet Explorer成功打开Notepad。如果我想从Firefox或Chrome浏览器打开应用程序,请告诉我如何编写此代码 <html> <head> <title>Application Executer</title> <HTA:APPLICATION ID="oMyApp" APPLICATIONN

我正在尝试从
Firefox
Chrome
浏览器打开一个文件。我已经编写了以下代码,它正在从Internet Explorer成功打开
Notepad
。如果我想从Firefox或Chrome浏览器打开应用程序,请告诉我如何编写此代码

<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 XMLHttpRequest("WScript.Shell");
        //WshShell.Run("c:/windows/system32/notepad.exe", 1, false);

        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>

应用程序执行器
函数RunFile(){
//WshShell=newXMLHttpRequest(“WScript.Shell”);
//运行(“c:/windows/system32/notepad.exe”,1,false);
WshShell=newActiveXObject(“WScript.Shell”);
运行(“c:/windows/system32/notepad.exe”,1,false);
}

由于安全问题,这是不可能的。它只适用于记事本和受信任的程序。现在谷歌chrome只允许谷歌的插件安装在chrome上一天。所以用户应该先下载文件,然后运行它。这样你想写的代码,可以很容易地破解或格式化用户的磁盘。

完成上述answare(雷扎·贾法里回答)我应该说,你见过在你的电脑上打开.exe文件的网站吗?绝对没有。所以这是不可能的,因为它很粗糙

检查这个[hta-火狐浏览器中的等价物,Chrome-这是一种旧技术吗?][1][1]:可能是