Click here to Skip to main content
14,384,992 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hi,
I have been trying to run an exe from a browser using Java Script. Below is the code I have been using for WindowsIE.

var MyObject = new ActiveXObject( "WScript.Shell" )
function RunExe()
{
MyObject.Run("file:///C:/Program%20Files/EditPlus%203/editplus.exe") ;
}

Can anyone tell me how to do the same using Chrome/FireFox with out any pop-ups. I know that the basic difference between IE and others is that IE uses ActiveX and others use NPAPI/runtime to install Plugins.

Any suggestions would help

Thanks
Rahul

What I have tried:

var MyObject = new ActiveXObject( "WScript.Shell" )
function RunExe()
{
MyObject.Run("file:///C:/Program%20Files/EditPlus%203/editplus.exe") ;
}
Posted
Updated 5-Jul-18 4:42am
Rate this:
Please Sign up or sign in to vote.

Solution 1

Quote:
How to run a .exe from chrome browser using javascript?

Short answer: you can't.
It is for security reasons.
Just imagine, you visit a random website and it launch any EXE it wants on your PC.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

You can't. If you could, every malware site out there would be doing it already.

Your existing code only works in Internet Explorer on Windows, and only if the user has (foolishly) ticked the "initialize and script ActiveX controls not marked as safe for scripting" option.

You might occasionally find a security bug which lets you launch an executable from a web page. But they tend to get reported and fixed very quickly.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100