Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to change the value of a particular about:config property via a script external to Firefox.

Have any of you tried this before? I've read that you can modify "prefs.js", but I was wondering if there was a simpler, more correct approach. For example, maybe a:

  • command-line argument to the Firefox executable (a batch file would work in this case)
  • a registry setting (a .reg file would work)
share|improve this question
    
Hmm... should this be on StackOverflow instead? –  Matt Refghi Sep 11 '09 at 18:09

2 Answers 2

up vote 5 down vote accepted

The comments in the prefs.js file:

# Mozilla User Preferences

/* Do not edit this file.
 *
 * If you make changes to this file while the application is running,
 * the changes will be overwritten when the application exits.
 *
 * To make a manual change to preferences, you can visit the URL about:config
 * For more information, see http://www.mozilla.org/unix/customizing.html#prefs
 */

That said, you should be able to edit the file with the application closed, and the new settings would take effect when it is launched.

Depending on what setting(s) you want to modify, however: I don't believe the registry or command-line options will get you the same settings. Registry settings are more system-specific and not per-user; and command-line parameters will give you specific instance switches for the application, such as window size and which profiles to load, etc.

If you know the specific setting you want to change, you could search for it in the prefs.js file with a regex (using VBScript would be my choice) write a new file with the replacement setting, then rename/delete files so that the new prefs.js replaces the previous one.

share|improve this answer
    
That'll work, thanks! –  Matt Refghi Sep 13 '09 at 0:49

Here is how you can script FireFox's customization for one or many Linux computers

  1. Make a backup copy of the file ~/.mozilla/firefox/mr8jxm35.default/prefs.js
  2. Customize Firefox by about:config
  3. Compare the backup with the actual prefs.js
  4. Create your script based on the desired customization

CustFireFox.sh

#!/bin/sh   
function SetFirefoxPref() {
  for PropName in "$@"; do
    LINE=$(grep -n "$PropName" ~/.mozilla/firefox/mr8jxm35.default/prefs.js | cut -f1 -d:)
    sed -i $LINE"s/true/false/" ~/.mozilla/firefox/mr8jxm35.default/prefs.js
    echo $PropName
  done
unset PropName
unset LINE
}

SetFirefoxPref \
    "browser.download.useDownloadDir" \
    "browser.fixup.alternate.enabled" \
    "browser.urlbar.trimURLs" \
    "general.warnOnAboutConfig" \
    "keyword.enabled"

You can call your script from the /etc/profile to ensure all current or new users, will have the same customization - You can also include proxy's settings etc

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.