是否可以从Addon上在Firefox上设置配置设置

Car*_*nas 6 settings firefox add-on firefox-addon application-settings

我正在寻找一种从网上打印而不提示打印对话框的方法(我刚刚提出了问题).

我发现Firefox的这种方法似乎有效,但它显然会影响所有网站.所以我正在考虑开发一个Firefox Addon,使这个配置只影响特定的网站.

我对构建Firefox插件一无所知,但如果可以通过这种方式更改设置,我将学习如何操作.

所以我的问题是..是否可以从Addon和特定网站在Firefox上设置配置设置?

非常感谢.

spe*_*001 6

如果您要开发Firefox插件,您可以"轻松"替换打印按钮并委托普通网站上的标准打印操作.对于URL列表,即您的网站,您暂时将print.always_print_silent设置为true并完成它.

要在插件中修改首选项,您可能会这样:

// Get the "accessibility." branch
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
    .getService(Components.interfaces.nsIPrefService).getBranch("accessibility.");

// prefs is an nsIPrefBranch.
// Look in the above section for examples of getting one.
var value = prefs.getBoolPref("typeaheadfind"); 

// get a pref (accessibility.typeaheadfind)
prefs.setBoolPref("typeaheadfind", !value); // set a pref (accessibility.typeaheadfind)
Run Code Online (Sandbox Code Playgroud)

(取自此片段).