admin管理员组

文章数量:1278855

I want to open a desktop application (or a shortcut) from my web page. I understand that this is not a common practice, but I would like to know whether it is possible.

I have tried using Custom URL Protocol Handling via the Windows Registry, but this approach requires user involvement and admin rights (modifying the registry, etc.).

What I Tried (Registry-Based Approach) I followed these steps to register a custom protocol in Windows:

- Press Win + R, type regedit, and press Enter.
- Create a New Protocol Key: HKEY_CLASSES_ROOT\MyApp
- Set the (Default) value to "URL:MyApp Protocol".
- Add a new String value named "URL Protocol" (leave it empty).
- Inside HKEY_CLASSES_ROOT\MyApp, create a subkey: HKEY_CLASSES_ROOT\MyApp\shell\open\command
- Set (Default) to the executable path, e.g.: "C:\Path\To\MyApp.exe" "%1"

This works, but it requires user confirmation and admin access to modify the registry. Also it is windows dependent solution, I am looking for multi OS supported solution.

My Requirement

I want to launch the application directly from my Angular web page without needing users to modify the registry manually. Is there any way to achieve this without admin rights or user involvement?

Any alternative solutions or workarounds would be greatly appreciated!

I want to open a desktop application (or a shortcut) from my web page. I understand that this is not a common practice, but I would like to know whether it is possible.

I have tried using Custom URL Protocol Handling via the Windows Registry, but this approach requires user involvement and admin rights (modifying the registry, etc.).

What I Tried (Registry-Based Approach) I followed these steps to register a custom protocol in Windows:

- Press Win + R, type regedit, and press Enter.
- Create a New Protocol Key: HKEY_CLASSES_ROOT\MyApp
- Set the (Default) value to "URL:MyApp Protocol".
- Add a new String value named "URL Protocol" (leave it empty).
- Inside HKEY_CLASSES_ROOT\MyApp, create a subkey: HKEY_CLASSES_ROOT\MyApp\shell\open\command
- Set (Default) to the executable path, e.g.: "C:\Path\To\MyApp.exe" "%1"

This works, but it requires user confirmation and admin access to modify the registry. Also it is windows dependent solution, I am looking for multi OS supported solution.

My Requirement

I want to launch the application directly from my Angular web page without needing users to modify the registry manually. Is there any way to achieve this without admin rights or user involvement?

Any alternative solutions or workarounds would be greatly appreciated!

Share Improve this question edited Feb 24 at 7:16 tink 15.2k4 gold badges50 silver badges57 bronze badges asked Feb 24 at 6:01 Akiner AlkanAkiner Alkan 6,9184 gold badges40 silver badges78 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

What app are you trying to launch? Standard / consistent path?

Security is your biggest limitation (ruined from days of ActiveX, Java). Anything you invoke, from my experience, will prompt the user in modern browsers. Plus you will need a fallback mechanism given the many pitfalls out of your control (different browsers, security).

Alternatives?

  • Check out NodeJS child_process?
  • Have you considered a browser extension? Have users install CRX/XPI to bridge the gap? You can post an extension to the extension stores and choose if public/hidden.
  • Run a small local web server (localhost:9876) to intercept communication with the web app?
  • Invoke another known less secure browser? microsoft-edge:... to call a local .bat file? eg. onclick="window.open('file:///Folder/Launch-XYZ.bat')". FF/Chromium usually view/download the file.
  • Scraping the bottom of the barrel... Have user download an .hta file (w/ vbscript or JS) or .bat file and shell.run() or start ExampleApp.exe?

More information required. I'm sure there are many alternatives. Good luck

本文标签: angularHow to Open a Desktop Application from a Browser Without User InvolvementStack Overflow