是否有可能从运行在Firefox或IE的网页上的JavaScript启动Windows进程 [英] Is it possible to start a Windows process from Javascript running in a web page in Firefox or IE

查看:173
本文介绍了是否有可能从运行在Firefox或IE的网页上的JavaScript启动Windows进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要了解Firefox(或IE)是否支持从网页中的< script> 标记中运行的JavaScript代码启动外部操作系统(Windows)页。作为一个简单的例子,我希望用户能够在网页上点击一个按钮(< input type =button... /> )会导致一些JavaScript的执行,将启动记事本(即c:\ Windows \ System32 \\\
otepad.exe)
(注意:在我的情况下,我需要启动一个自定义的.exe创建与我一起工作的开发人员,而不是记事本。)

我相信这可能是不可能的,因为它显然会带来极大的安全风险。 (例如,您加载我的恶意网页,我的页面运行一些运行外部Windows进程的JavaScript来删除您的文件系统)。也许有办法解决这个问题,并仍然在浏览器中保持一个安全的环境?

额外的小复杂性是,我需要能够通过命令行参数到启动时进程。

解决方案

你可以编写一个自定义的协议来处理浏览器打开某种请求程序在操作系统。就像mailto://youremail@gmail.com一样。



我不是专家,但你可以检查一下。



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



也是这个答案...



我如何创建自己的URL协议? (例如:// ...)


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.

解决方案

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://...)

这篇关于是否有可能从运行在Firefox或IE的网页上的JavaScript启动Windows进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆