我想用我的插件更改用户的firefox配置设置。我该怎么做,我想要更改用户的配置与在同一个标签中打开链接有关,该标签会将browser.link.open_newwindow.restriction切换为0。
答案 0 :(得分:1)
如果是Addon-SDK扩展,请使用以下内容:
var name = "browser.link.open_newwindow.restriction";
require("sdk/preferences/service").set(name, 0);
如果它是无重启或经典(重叠)扩展程序,您可以使用nsIPrefService
和nsIPrefBranch
(通过Services.jsm
)
var {classes:Cc, interfaces:Ci, utils:Cu, results:Cr, Constructor:CC} = Components;
const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
var branch = Services.prefs.getBranch("browser.link.open_newwindow.");
branch.setIntPref('restriction', 0);