How to Open a Windows Program with JavaScript?

半腔热情 提交于 2019-12-06 10:00:18

问题


So I'm trying to make a projects hub for Windows (run locally with Localhost) that will open different apps (e.g. a CAD program) at the click of a button. Is this insecure? If not, how would I do it? If so, is there an alternative? Thanks!


回答1:


A URI (Uniform Resource Identifier) will provide for the best user experience. A URI is a schema that can launch an application as well as pass data into the application. The most common example of a URI is the mailto: for launching a computer's mail client from a website.

Creating a URI involves editing the registry. Here is some Microsoft Documentation on how to do it. Looking at other examples in the registry like mailto: https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx

Lastly, I have seen people use <a href="path.lnk"> to shortcut links that works ok in Internet Explorer. You will still get a prompt to open or save; however, its the simplest solution.



来源:https://stackoverflow.com/questions/40615735/how-to-open-a-windows-program-with-javascript

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