FireFox Addon WebExtension API - 打开本地文件/应用程序 [英] FireFox Addon WebExtension API - open local file / appliction
问题描述
var {Cc,Ci} = require(chrome); //低级API导入(对于启动器)var prefs = require(sdk / simple-prefs)。prefs; var app =C:\\\\\\\\\\\\\\\\\\\'抄送[@ mozilla.org/file/local;1\"].createInstance(Ci.nsIFile);file.initWithPath(app);var process = Cc [@ mozilla.org/process/util;1\"].createInstance (Ci.nsIProcess); if(file.exists()){process.init(file); var params = prefs [param]; var args = [+ params +]; process.run(false,args,args.length);}
通过使用WebExtension API编写mozilla firefox扩展的源代码如何?
不幸的是,我不能使用您的建议解决方案,因为必须进行设置本地PC附加到插件。我想阻止进行这些设置。我对一个解决方案很感兴趣,在这个解决方案中,一个可变路径可以直接从浏览器中执行。例如,一个文件夹或一个本地文件应该在那里打开
不能单独使用webextensions完成(webextensions部分意味着阻止这个),你也必须安装一个本地应用程序,然后通过消息传递给它,使用本地消息api 。
I would like to write a mozilla firefox extension by using the WebExtension API. I couldn´t find a source code using the WebExtension API for my purposes.
var {Cc, Ci} = require("chrome"); // Low-Level API Imports (For Launcher)
var prefs = require("sdk/simple-prefs").prefs;
var app = "C:\\abcd\\test.exe";
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
file.initWithPath(app);
var process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
if (file.exists()) {
process.init(file);
var params = prefs["param"];
var args = ["" + params + ""];
process.run(false, args, args.length);
}
How does a source code for writing a mozilla firefox extension by using the WebExtension API look like?
Unfortunately I can´t use your suggested solution, because there have to be made settings on the local PC additional to the Addon. I would like to prevent making these settings. I am interested in a solution, where a variable path can be executed directly out of the Browser. For example, a folder or a local file should open there
can't be done with webextensions alone (webextensions were in part meant to prevent this), you'd have to have a native app installed as well, and message pass to it, using the native messaging api that was mentioned.
这篇关于FireFox Addon WebExtension API - 打开本地文件/应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!