IMPORTANT: defaults/pref no longer works as a location for default preference files. You should use defaults/preferences. (You will have to create this directory.) See this post.
One of the most talked about subjects on the Enterprise Working Group Mailing List is customizing Firefox. There are quite a few different methods that people are using today, and there are more that people don't know about.
I'm going to do a series where I go over each method (that I know about) and detail how it works and what it can change. This should allow people that are customizing Firefox to make more informed choices about which method to use.
The first method we're going to talk about is adding default preference files.
If you go to the URL bar in your browser and type about:config, you'll see all of the various preferences that have been set in your browser. You'll notice that some of them are bold and some are not. You'll also notice that for the bold ones, it says "user set" in the Status column. These are the preferences that have been customized in your browser. The rest of the settings are marked "default" and are the default settings for the browser. (If you have some locked preferences, the status will say "Locked" and the preference will be in italics. We'll talk more about those in a later post.)
Adding default preferences is as simple as creating a file with the extension of .js in the defaults/preferences directory and adding lines like:
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.
In this example, we're setting a boolean value that tells Firefox that the rights notification has already been shown. This is the notification when you first run Firefox that says "Mozilla Firefox is free and open source software..."
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. (There's a bug open for locking via a default preferences file.) There are also preferences you can't set at all via this mechanism, like browser.startup.homepage. This preference is a complex preference and uses a different mechanism. We'll be talking about other methods can set this preference.
So using a default preference file is good if all you want to change is the default value for a few preferences. It doesn't let you lock preferences and it doesn't let you change the homepage.