Is there a way to make a HTML link that would run a program from local computer?

删除回忆录丶 提交于 2020-02-05 05:30:26

问题


For debugging purposes it'd be nice if I could make my error page display clickable file names in exception stack traces that would open them up in my favorite editor. However this would require me to execute a full command line - a simple link to a file will not do. Can this be done?

The solution can be IE-only and it can use techniques that require full trust (I don't expect it to be otherwise anyway). People are only going to use this on localhost, I will in fact disable this functionality when viewing the page remotely.


回答1:


You can add a new protocol to Windows as outlined here .

This is especially nice because it works across browsers, and doesn't require any browser specific settings.

Just be careful with it - adding a new protocol handler opens potential, although very remote, vulnerabilities. When setting this up, never let the incoming URL be somehow a parameter to a generic command interpreter (like cmd). Always link it to an existing application that is not able to do anything destructive, not even through command line switches.



来源:https://stackoverflow.com/questions/3567003/is-there-a-way-to-make-a-html-link-that-would-run-a-program-from-local-computer

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