[英]Run exe from JavaScript code in Mozilla Firefox
I want to execute a .exe file via javascript, but ActiveX in Mozilla is not supported. 我想通过javascript执行.exe文件,但是不支持Mozilla中的ActiveX。
I read that it could be done via nslProcess
so I tried the following: 我读到它可以通过
nslProcess
完成,所以我尝试了以下操作:
var exe = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
exe.initWithPath("c:\\WINDOWS\\notepad.exe");
alert("exe");
var run = Components.classes['@mozilla.org/process/util;1'].createInstance(Components.interfaces.nsIProcess);
run.init(exe);
var parameters = [""];
run.run(false, parameters,parameters.length);
alert("in function RunBat");
}
And got the following error: 并得到以下错误:
TypeError: Components.classes is undefined.
What did I do wrong and are there any alternatives that are supported by the latest versions of Firefox? 我做错了什么,最新版本的Firefox是否支持其他选择?
PS I have all full access on localhost. PS我在本地主机上具有所有完全访问权限。
Update: 更新:
Can I create Firefox extension which get value of inputExePath field in simple webpage and run exe in that path? 我可以创建在简单网页中获取inputExePath字段值并在该路径中运行exe的Firefox扩展吗?
无法通过在网页中运行的JavaScript访问Components.classes
,而只能通过在Firefox扩展中运行的JavaScript访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.