Click here to Skip to main content
15,849,197 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi I am looking for to run this Set up file specially in MS EDGE Browser .It does not work in EDGE .How do I achieve this what changes needs to be done . Please Help .

What I have tried:

<script type="text/javascript">
    function Launch()
    {
        alert("-1");
        try
        {
            var ws = new ActiveXObject("WScript.Shell");
            var servername = "<%=Server.MachineName%>";

            var exename = "\\\\Uszz\\interoffice\\Training\\Coll Mod - Datastore\\PROD\\\\setup.exe";
            ws.Exec(exename.replace("Server", servername));

            return true;
        }
        catch (ex)
        {
            alert(ex);
        }
    }
</script>
Posted
Updated 20-Jul-22 2:52am

1 solution

You can't. Javascript code running in a web page CANNOT launch random programs from the local computer's network, since this would be a massive security risk.

And no, there is no way around this.

And no, "it's a client requirement" isn't a magic incantation that makes this security restriction go away.

The best you can do is have your web server read the exe from disk and send it back in the response. The user will then be able to choose whether to open, save, or discard the file.
 
Share this answer
 
Comments
Thirumadhi T Johnson 20-Jul-22 8:04am    
Hi @Richard Deeming any reference/guide how to write for
web server read the exe from disk and send it back in the response. The user will then be able to choose whether to open, save, or discard the file.Please
Richard Deeming 20-Jul-22 8:07am    
That depends on what server-side language and framework you're using.

For example, if you're using ASP.NET MVC, you'd have an action method that looked something like:
public ActionResult DownloadSetup()
{
    string path = @"C:\Some\File\Path\Here\setup.exe";
    return File(path, "application/octet-stream", "setup.exe");
}
Thirumadhi T Johnson 20-Jul-22 9:00am    
Ohk Thank You I will try this code .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900