Run a program from a local webpage

孤人 提交于 2019-11-30 14:01:21

If i get your question right , the closest thing to get what you want would be using *.hta which is a HTML Application that runs outside the browser window just like a normal app.

<script type="text/javascript" language="javascript">
    function RunFile() {
    WshShell = new ActiveXObject("WScript.Shell");
    WshShell.Run("c:/windows/system32/notepad.exe", 1, false);
    }
</script>

Bit more info here: http://www.kunal-chowdhury.com/2010/09/how-to-execute-local-file-using-html.html

The right way to implement this is by creating custom protocol in Windows. Details in the MSDN article "Registering an Application to a URI Scheme"

No, this is security issue, browsers don't allow it because it could be security risk to run apps without prompt, just by clicking on the link.

There are several technologies like java WebStart and ASP ClickOnce - they will install the app more or less automatically, signing the application helps too - the messages the user gets look less scary.

Correct me if I didn't understand you. If you're running the web page locally (http:\127.0.0.1) and want to execute a program in the same machine, it will depend on the technology that you're using, for example in php you could use exec() to execute a program on user input but it will run on the server side.

That's of course a security issue. But that's not the problem, the reason why he want to do that is clearly another problem.

The question still remains : HOW to execute an external program from CLIENT/SERVER side ?

I found some clues :

  • ActiveX : Specific to IE, so not very nice,
  • Serverside javascript frameworks, like Node.js : Server side ? I don't even know this framework...^^',
  • Crossbrowser addons which can enhanced possibilities, not my domain here too,
  • In Media player classic, you can make him listen to a port, and then use this to call the program by using specific command urls, pretty nice, but specific to a software.

I found tons of others cool tutorials, but the work is pretty heavy : Each time i have to discover & learn another technology.

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