Click here to Skip to main content
15,885,680 members
Please Sign up or sign in to vote.
1.00/5 (1 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 3:42am

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.
 
Share this answer
 
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.
 
Share this answer
 

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