Is it possible to start a Windows process from Javascript running in a web page in Firefox or IE

纵饮孤独 提交于 2020-01-16 18:02:32

问题


I need to understand if Firefox (or IE) supports starting an external operating system (Windows) process from JavaScript code running in a <script> tag in the web page. As a trivial example, I want the user to be able to click a button (<input type="button" .../>) in the web page which would cause some JavaScript to be executed that would start Notepad (i.e. c:\Windows\System32\notepad.exe) (Note: in my case, I need to start a custom .exe created by one of the developers I work with, not Notepad.)

My belief is that this is likely impossible, since it would obviously pose an extreme security risk. (e.g. You load my evil web page, my page runs some JavaScript which runs an external Windows process to delete your file-system). Perhaps there is a way to get around this, and still maintain a secure environment in the browser?

The additional minor complexity is that I need to be able to pass command line parameters to the process when it starts.


回答1:


You could write a custom Protocol that handles a request from the browser opening some kind of program in the OS. Something like the mailto://youremail@gmail.com works.

I'm not an expert at it but you can check this Out.

https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx

Also this answer...

how do I create my own URL protocol? (e.g. so://...)



来源:https://stackoverflow.com/questions/29013486/is-it-possible-to-start-a-windows-process-from-javascript-running-in-a-web-page

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