The web browser opens the local exe application

1. How to make the web browser open the local exe application?

We can use the ActiveXObject method to open the local exe program in the browser, but only IE is supported, and browsers such as Google and Firefox do not support this operation.
The question is, how should we operate?
After continuous learning and exploration by this blogger, I finally found a way to play local exe applications like Baidu Netdisk. We can add a private protocol similar to http (only valid locally) to the system by adding the registry, and then invoked by the browser.

2. How to add registry

1. Write the registry file as follows:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CodeWebshell]
@="URL:CodeWebshell Protocol Handler"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\CodeWebshell\DefaultIcon]
@="D:\\soft\\Microsoft VS Code\\Code.exe"

[HKEY_CLASSES_ROOT\CodeWebshell\shell]
[HKEY_CLASSES_ROOT\CodeWebshell\shell\open]
[HKEY_CLASSES_ROOT\CodeWebshell\shell\open\command]
@="\"D:\\soft\\Microsoft VS Code\\Code.exe\" \"%1\""

2. Save the registry as xxx.reg( xxx随便起名字只要是.reg文件结尾就可以), double-click to execute (as shown in the figure below).

insert image description here

3. Write front-end web code ( CodeWebshell为脚本中自己定义的名字,如果不喜,可以在.reg文件中修改。)

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>测试exe调用</title>
</head>
<body>
  <a href="CodeWebshell:\">运行exe</a>
</body>
</html>

4. Test effect

insert image description here
Click to open it.

Guess you like

Origin blog.csdn.net/Jensen_Yao/article/details/132145532