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

前端 未结 1 1189
广开言路
广开言路 2020-12-09 00:45

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) web

相关标签:
1条回答
  • 2020-12-09 01:38

    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.

    0 讨论(0)
提交回复
热议问题