0
我想通过javascript执行.exe文件,但不支持Mozilla中的ActiveX。在Mozilla Firefox中运行JavaScript代码执行exe
,我读了这是可以做到通过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");
}
而且得到了以下错误:
TypeError: Components.classes is undefined.
我做了什么错误以及是否有任何替代品是否支持最新版本的Firefox?
P.S. 我有本地主机上的所有完全访问权限。
更新:
我可以创建Firefox扩展其获得inputExePath领域的价值在简单的网页,并在这条道路的exe运行?
看到这个答案http://stackoverflow.com/questions/21378058/why-components-classes-is-undefined – Girish
感谢上帝,这是不可能的。你试过的代码只能在Firefox插件中运行。 – torvin