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

荒凉一梦 提交于 2019-12-20 10:14:46

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/37415841/how-to-run-local-program-exe-via-chrome-via-html-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!