If you intend to create a Firefox add-on, you can easily replace the print button and delegate the standard print action to regular websites. For a list of URLs i.e. On your website, you temporarily set print.always_print_silent to true and executed it.
To change the preference in the addon, you will have something like this:
// 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)
(taken from this snippet ).
source share