changing print preferences using javascript

"Steven Turoff" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.prefs
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Greetings,

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 = "I am new header left"
    prefs.setCharPref("print.print_headerleft",headerleft)
    var newHeaderLeft =

    // Change homepage (for testing purposes only)
    var homepage = 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 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.