如何在我的firefox扩展中运行本地exe?

jin*_*jin 4 javascript firefox firefox-addon

我想在我的firefox扩展javascript文件中运行本地exe,但ActiveXObject("WScript.Shell")在IE中工作正常,而不是在FF中,如何在Firefox中的js中运行本地exe.

paw*_*wel 9

由于您已明确要求提供.exe,因此您可以使用nsILocalFile.launch():https: //developer.mozilla.org/en/Code_snippets/Running_applications

var file = Components.classes["@mozilla.org/file/local;1"]
                     .createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("c:\\myapp.exe");
file.launch();
Run Code Online (Sandbox Code Playgroud)

如果你想跨平台,你应该考虑一下 nsIProcess