Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run local program (exe) via Chrome via HTML/javascript

I am trying to build a (single page) local portal in Chrome that opens several things.

The problem is we want to run a local executable via a button on a (local) webpage. Is this possible?

The second thing is that i want to do is to run a .pps file directly in the powerpoint viewer.

I can control to the startup of chrome, so i can access local files.

All things i tried so far only made the file(s) to download, not to run.

Can somebody help me how i get this done?

like image 306
Alain Vanderbroeck Avatar asked May 24 '16 13:05

Alain Vanderbroeck


People also ask

How to run a exe from Chrome browser using JavaScript?

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.

Can you run an EXE file on a HTML file?

You can't run an exe file on a html. (First, if it's a Linux server, exe files won't run on it and second, if you're on a Windows server, your host would kill the program immediately. And probably terminate your account.) Can somebody explain .bat files and .exe files to me in detail?

Is it possible to run OS EXE files in a browser?

The security risks of giving scripts within a browser access to the underlying OS are great and are either extremely limited or not allowed at all. Writing a Chrome extension could allow more than would be possible with JavaScript alone, but even then I don’t think opening and running OS exe files is something that is possible.

Can I make a button in HTML that launches an EXE file?

How can I make a button in HTML that launches an already downloaded .exe file? It May be possible but likely to be discouraged and deprecated as a security risk. What if you made this button and then programmatically clicked it? Then you would be able to run any program by having someone visit a webpage.


1 Answers

You can set a protocol like myapp://launch/activity or the like to automatically launch your app by setting up a registry key in HKEY_CLASSES_ROOT with the name of your protocol and the action it should take.

There is a MSDN article showing the following example of a registry for an alert protocol:

HKEY_CLASSES_ROOT
   alert
      (Default) = "URL:Alert Protocol"
      URL Protocol = ""
      DefaultIcon
         (Default) = "alert.exe,1"
      shell
         open
            command
               (Default) = "C:\Program Files\Alert\alert.exe" "%1"

Which would then be called by requesting a url with alert:YOURPARAMS, which would then call alert.exe YOURPARAMS.

like image 50
MiltoxBeyond Avatar answered Nov 14 '22 02:11

MiltoxBeyond