10

Is it possible to modify some of the default settings for Firefox globally?

I know how to change settings for user using about:config. But I would like to have my changes globally, so that any newly created account will inherit my changes.

I have noticed the file /usr/share/iceweasel/browser/defaults/preferences/firefox.js which looks like this might be the place to change settings globally.

Is this the correct way of doing it, or is there a better way? I want to prevent any unintended consequences.

I am using Firefox (Iceweasel) 24.8.1 on Debian.

11
+100

Yes you can. Mozilla calls this "locking preferences", but I prefer to think of it as "system preferences" (they don't have to be locked).

First, tell Firefox you will be using a system preferences file by creating a text file called local-settings.js in defaults/pref of your Firefox installation directory with these two lines:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

Second, your system preferences file. Create a text file called mozilla.cfg in your Firefox installation directory. The first line must begin with double forward slashes, then add your preferences (the same preferences as found in about:config). An example:

//
pref("browser.startup.homepage", http://www.superuser.com);
pref("browser.shell.checkDefaultBrowser", false);

You have a few options in how you add the preferences:

  • defaultPref - set new default value
  • pref - set pref, but allow changes in current session
  • lockPref - lock pref, disallow changes
3

From Customizing Firefox - Default Preference Files :

The default preferences are stored in various files like all.js or firefox.js. It is not recommended that you modify these files directly (and you can't easily, because they are stored in the file omni.jar). You can, however, create your own Javascript files and place them in a location so that Firefox reads them as default preferences. That location is the defaults/pref directory in the same location where the Firefox executable is placed. Files in this location will be used for all Firefox users (they are not profile specific).

Adding default preferences is as simple as creating a file with the extension of .js in the defaults/preferences directory and adding lines like:

pref("browser.rights.3.shown", true);

It's important that you get the format right based on the preference type. In this case, the preference is a boolean, so we specify true or false without quotes as the value on the right. If it is a string, you put it in quotes. If it is an integer, you put the value without quotes. You can tell the type of the preference by looking at the Type column in about:config.

All you can do with the default preferences file is set the default value of preferences. You cannot lock them and you cannot override user set preferences.

If this procedure is too unwieldy, because of the trouble of finding the right names for the preferences, one can use the add-on CCK Wizard which provides an easier wizard-like interface :

The CCK Wizard can be used to create an extension that customizes Firefox. To access it, after installation, select Tools->CCK Wizard.

I created this add-on so that people could deploy Firefox exactly the way they wanted, especially enterprise users and educational institutions.

Mozilla does not do enough to support corporate users, and this was my attempt to remedy that.

It allows the following customizations:

  • Add identifier to the user agent string
  • Change the default home page and startup override home page
  • Change the title bar text
  • Change the animated logo
  • Change the web page and tooltip used for the animated logo
  • Add a help menu item that links to a web page
  • Provide sites for which popups and XPInstalls are allowed by default
  • Preinstall browser plug-ins
  • Preinstall search engines
  • Add a folder, bookmarks and live bookmarks to the personal toolbar
  • Add a folder, bookmarks and live bookmarks to the bookmarks folder
  • Set default preferences
  • Lock preferences
  • Add registry keys (Windows only)
  • Add certificates
  • Set default proxy configurations
  • Package other XPIs with your distribution
  • Disable about:config

EDIT: CCK has has become CCK2 and moved to here.

0

Add a file called greprefs.js to the Firefox application directory. In that file, create preferences in the same format as a standard prefs.js file.

The greprefs.js file contains preferences shared amongst all Mozilla applications.

For more detail, see: https://developer.mozilla.org/docs/Mozilla/Preferences/A_brief_guide_to_Mozilla_preferences

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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