Customizing Firefox – Default Preference Files

IMPORTANT: As of Firefox 21, there are two locations for default preferences, defaults/pref and browser/defaults/preferences. Because of the order in which Firefox loads files from these two locations, some preferences can’t be set in defaults/pref. If you find a preference doesn’t work in one location, try it in the other..

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.)

All of these preferences are stored in JavaScript files. Your customized settings are stored in a file called prefs.js in your profile directory. 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.ja[r]). 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/preferences 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.

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.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

40 thoughts on “Customizing Firefox – Default Preference Files

  1. Thanks for starting this list. This is useful information and I’m glad someone is tracking the Enterprise product this way.
    I have one question, what if I want to change the defaults within firefox itself (perhaps in firefox/defaults/pref/, so I don’t have to tweak user profiles? Would .js files and be honored for all users who run Firefox on this system?

    • The changes I’ve indicated in this post are definitely changes to firefox/defaults/pref and they will be honored for all users that run that version of Firefox.

      Most of the changes we’ll be talking about in this series will apply to the installed Firefox, so they will happen to all users on the system (Or you can bundle the changes with a Firefox that you are distributing.)

  2. Hi Mike,

    Sorry to ask probably a newbie question – I am trying to set a default homepage for every firefox user and then allow them to change that if they like.

    To do so I have used local-settings.js and mozilla.cfg and used either a lockPref(“browser.startup.homepage”, “”); or a pref(“browser.startup.homepage”, “”); in mozilla.cfg to set the default. I have also tried defaultPref() but get the same results as commented yesterday by Stefan in

    I am then trying to use a user.js to overwrite the setting defined for browser.startup.homepage on mozilla.cfg. I know my user.js works as I am able to change other settings but I can’t change the browser.startup.homepage if it has been set by mozilla.cfg regardless if I use pref() or lockPref().

    Hope this makes sense and any help you can provide would be welcomed.

    Thanks in advance,


    • The homepage must be a URL –

      What you want is a default pref, but to do a default pref, it can get weird. Use:

      defaultPref(“browser.startup.homepage”, “data:text/plain,browser.startup.homepage=”);

      and it should work.

      All this should work via CFG files.

      • Thanks Mike,

        Worked a treat!! Solved my problems. I have found your articles an excellent ready – keep them up.


  3. I cannot get the lockpref to work. RH6.3, Firefox 18.

    I created mozilla.cfg at:
    It contains two lines:
    lockpref (“security.enable_ssl3”, true);

    I created local-settings at:

    It contains two lines:
    pref(“general.config.obscure_value”, 0);
    pref(“general.config.filename”, “mozilla.cfg”);

    When I goto about:config, it still shows security.enable_ssl3 false.

    any ideas???

  4. Hello,

    I work as a System administrator in an international company.
    We wish to push some bookmark on users Firefox (15.0.1 for most of them).
    I look for a help everywhere but no way to do it.

    Can you please give me some tips ?

  5. I am looking for a way to non-customizable default header and footer. I read the above post to add a default/preferences so that I can change the default header and footer. But, I also need to inhibit the ability to modify them. All that can be permitted is to print. Any suggestions?

    Soo much good info here!


    • I’m surprised you were able to change them. They are quite painful to change. Did you use a printer name in the preference? Like:

      pref(“PRINTERNAME.print_headerleft”, “”);

      If you were able to change them, you can lock them using:

      lockPref(“PRINTERNAME.print_headerleft”, “”);

      in an autoconfig file. Although it looks like the user is changing them in the user interface, they value will not actually be changed.

  6. Hi mike, I’m a little confused; in this post you say that placing the Default Preferences file in Defaults\Prefs doesn’t work anymore, that it has to go in Defaults\Preferences. I am assuming that you are talking about c:\Program Files\Mozilla Firefox\Defaults so I looked there and there is a Prefs folder but not a Preferences folder. I should say that I am using Firefox 25.0.1; is it possible that Mozilla has changed folders again? If not then my best guess is that I have to create the Preferences folder.

    I have a couple of other questions if I can remember what they are. I know I am wondering if there is any name that I should not use for the default preferences file. For example, could I call it Defaults.js?

    I can’t remember what the other one was so I guess I’ll have to try again some other time.


    • Yeah, it’s quite confusing. Since these posts are a point in time, they don’t convey it well.

      As of now, I only recommend configuring your AutoConfig file in defaults/pref and then configuring all preferences in an AutoConfig files.

      defaults/pref and browser/defaults/preferences can be unreliable because they depend on how Firefox chooses to load the preferences.

      As far as the filename goes, the reason I tend to use certain names is because Firefox loads them in alphabetical order.

  7. Mike, I remember what the other question was; I want to read the whole “Customizing Firefox” series but I can’t figure out how to do that. I found “Customizing Firefox – Autoconfig Files” and then I found the link to this one. There seem to be a lot of other Customizing Firefox articles but they don’t seem to be any that would fit in-between these two. If there are how can I find them.

  8. The second line of this article is wrong, it gives the directory name as “You should use default/preferences.” when it should instead be “defaults/preferences”.

  9. Hi Mike,

    I’ve integrated your CCK wizard into my firefox distribution, and this works seamlessly.

    However, I have now been asked to lock firefox down so that it can only be used to access one particular website. Unless you know of another method, the only way I could find to do this was using the ‘blocksite’ add-on.

    My question is, how do I add this add-on in so that it will be available to all users and all users will share the same default preferences of the add-on?

    I can see there is an option within the CCK to add an .xpi file – but how then do I configure the default prefs for the add-on?

    I have a copy of the preferences created within the prefs.js of my profile directory. Can I store these preferences in a file within the program folder so each user will read them?

    Many thanks,

  10. Hi Mike.

    I have a few questions im hoping you can answer for me.
    Regarding adding files to omni.ja(r). You mention not to (re)pack it. How would I be able to do the following:

    insert my cert8.db
    and insert my updated prefs.js

    Basically I need to create a “packaged” enterprise version of FF, but I have to include some certs and proxy settings. I think it would be easier to package these up, that way when the users install the application, they will have those items pre populated. This is on a Mac btw.


  11. Helpfull work for all Enterprise User !,
    but a little bit outdated, maybe it is a good idea to update the correct FF directory path….. (defaults/pref )

  12. Hi, I am new to administering Firefox. We are currently using 34.0.5. I want to disable automatic updates completely. I created and configured the .js and cfg files and placed them both in the C:\Program Files (x86)\Mozilla Firefox\defaults\pref directory. However, Firefox will not launch and returns an error that it cannot read the cfg file. I ensured the file name is correct and that the first line of the cfg file is blank. What am I missing?

  13. Hello,
    I was wondering if there is a way to change the following through CCK2.


  14. Hello,

    thanks for the work and the details to make custom firefox;
    I read many pages but I have not found a solution to my problem:
    in practice I would set in a preferences file the sites for which I would like to allow popups;

    I realized that these info are stored in files permissions.sqlite
    but with my settings file is deleted every time I close the bowser

    There is no way to write these websites in a static preferences file and that remains unchanged?

    Thanks in advance,

  15. Hi Mike,

    we are in process of deploying firefox with VM Application publishing, that would connect to a specific website with lock down to browser. how can i achieve this pref setting for example in chrome

    i can use command parameter to to launch chrome to specific website with lock down mode.
    “C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –app= i want to acheive same results in firefox, but unable to do. can you help me

    • Firefox doesn’t have anything similar to that. You can build a single site browser to do something like that, but there is nothing built in.