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

标签 javascript firefox firefox-addon

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

最佳答案

既然你已经明确要求一个 .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();

如果你想让它跨平台,你应该看看nsIProcess

关于javascript - 如何在我的 firefox 扩展中运行本地 exe?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2490713/

相关文章:

javascript - 如何用 span 包装突出显示的文本并在 javascript 中放置一个相对于它定位的 div?

javascript - 如何对 javascript 进行单元测试?

Javascript:alert ('...' ) - 错误:未捕获的异常:ReferenceError:未定义警报

html - 在 Mozilla 上用 margin-right 隐藏滚动条会弄乱内容

javascript - 我想制作浏览器插件/扩展,我需要学习哪种编程语言?

firefox-addon - 以编程方式安装 Firefox 插件?

javascript - 删除类添加的事件监听器

javascript - node.js 是服务器还是引擎?

ruby-on-rails - 我怎样才能在 heroku 上使用 firefox

javascript - 有没有办法关闭 Chrome 扩展程序或 Firefox 插件的源代码?