changing print preferences using javascript - CORRECTION
"Steven Turoff" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.prefs |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Greetings,
My last post may have been illegible. The correct question is below:
I would like to modify Mozilla's print header and footer
in a javascript function. I've written the following code:
function printMe()
{
const secEverything = "UniversalXPConnect " +
"UniversalFileRead " +
"UniversalBrowserRead " +
"UniversalPreferencesRead " +
"UniversalPreferencesWrite " +
"UniversalBrowserWrite"
netscape.security.PrivilegeManager.enablePrivilege(secEverything)
var prefs =
Components.classes["@mozilla.org/preferences-service;1"].getService(Componen
ts.interfaces.nsIPrefBranch)
// Change headerleft
var headerleft = "&U"
prefs.setCharPref("print.print_headerleft",headerleft)
var newHeaderleft = prefs.getCharPref("print.print_headerleft")
// Change homepage (for testing purposes only)
var homepage = "http://www.yahoo.com"
prefs.setCharPref("browser.startup.homepage", homepage)
var newHomepage = prefs.getCharPref("browser.startup.homepage");
}
After running the above function, the the variable vewHomepage contains
http://www.yahoo.com and if I click on Edit | Preferences I can see that the
homepage has been changed. However, while the variable newHeaderleft
contains the value
"&U", going to File | Page Setup | Margins & Header/Footer shows that the
left header did not change.
Any help would be much obliged.
Steve