0

I am trying to open a file from Firefox or Chrome browser. I have written the following code and it is successfully opening Notepad from Internet Explorer. Kindly tell me how to write this code if i want to open an Application from Firefox or Chrome Browser.

<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>
Taha Kirmani
  • 1,274
  • 6
  • 26
  • 55
  • check this [hta - Equivalents in Firefox, Chrome - Is this old technology?][1] [1]: http://stackoverflow.com/questions/10619990/hta-equivalents-in-firefox-chrome-is-this-old-technology – Nuwan Dammika Nov 11 '13 at 09:31
  • Possible duplicate of [How to launch an EXE from Web page (asp.net)](http://stackoverflow.com/questions/916925/how-to-launch-an-exe-from-web-page-asp-net) – Liam Sep 30 '16 at 12:40

2 Answers2

1

because of security issues it's not possible.it's work just for notepad and trusted program.now a days google chrome just allow to google's plugin to be install on Chrome.so user should first download file and then run it.such this code that u want to write,easily can hack or format user's disk.

reza jafari
  • 1,228
  • 13
  • 14
  • It is possible to launch an `.exe` from a web page if you register a [custom URL protocol](https://stackoverflow.com/questions/80650/how-do-i-register-a-custom-url-protocol-in-windows) for it. – Anderson Green May 05 '22 at 23:45
0

for complete above answare( reza jafari answer ) i should say that,have u ever seen any web site that open .exe file on u'r computer?absolutly no.so it's not possible because of scurity

reza jafari
  • 1,228
  • 13
  • 14