Customizing Firefox – Default Profiles

Update: This method no longer works in Firefox 46..

Update: The locations of the files in this post have changed. I believe I’ve updated them all, but if you have problems, see this post.

Update: I have made major modifications to this post. I was not aware that Firefox copied the contents of the defaults/profile directory on the file system after using the files on omni.ja(r).

This next method of customization is not as widely used, but it is still worth mentioning. It involves changing the files that Firefox uses when creating a new profile. We’ll also take this opportunity to talk about userContent.css and userChrome.css which we mentioned earlier.

When you create a new profile in Firefox, the profile is prepopulated from the directory browser/defaults/profile in the file omni.ja(r) as well as the contents of the browser/defaults/profile directory where Firefox is installed. The contents of the browser/defaults/profile directory are copied over after the files in omni.ja(r). To retrieve the files you want to modify, unzip the file omni.ja(r) which is located in the Firefox directory. It’s just a zip file renamed. Make sure you unzip it into a temporary directory. You’ll see the following files in the browser/defaults/profile directory:

bookmarks.html
chrome/userChrome-example.css
chrome/userContent-example.css
localstore.rdf
mimeTypes.rdf
prefs.js

Copy the files you want to modify into the directory browser/defaults/profile underneath where the Firefox executable is located (you’ll have to create this directory). When a new profile is created, these files (and any other files that are also in the directory) are copied over. You have a two choices when it comes to modifying the default profile – changing the existing files or adding your own.

If you add additional files into this directory, those files are copied into the default profile along with the rest of the files. This is most commonly used if you want to have default certificate databases. I’ve seen cases where someone started Firefox, added the certificates and certificates authorities they needed and then copied the various *.db profiles from their profile and put them in the default profile so all their users would get them.

The other thing you can do is modify the existing files.

You can modify bookmarks.html to add or remove bookmarks. The file has a somewhat unique format, but it’s pretty straightforward to change.

You can modify prefs.js to set default preferences for a user. Here’s an example of setting a preference in prefs.js:

user_pref("browser.startup.homepage", "http://mike.kaply.com");

You can overwrite localstore.rdf if you want to customize the browser. localstore.rdf stores things like the size of the browser, whether or not certain toolbars are displayed and more. You can make customizations in your browser and then copy the localstore.rdf from your profile into the default profile.

But by far the most interesting files in the default profile are userChrome-example.css and userContent-examples.css. When these files are present in your profile using their correct names – userChrome.css and userContent.css – they can be used to override just about anything on web pages and in the browser.

userChrome.css allows you to modify the chrome of Firefox. That’s the area around the browser window. So for instance, if you wanted all menuitems to be bigger, you could specify:

menu, menuitem {
  font-size: 32px !important;
}

There are so many things you can do with this file, I couldn’t even begin to describe them here. You can hide menuitems, change parts of the UI, etc. If you choose to hide something, it’s better to use visibility: collapse than display: none. Messing with display can cause very strange results in Firefox. If you’re interested in figuring out the IDs of the various elements of the UI, check out the DOM Inspector. You can also just browser through the source code. browser-menubar.inc and browser-context.inc are particularly useful.

userContent.css allows you to customize the content of web pages. There are even ways to make your styles only apply to certain web pages. There’s a ton of information about userChrome.css on the web, so I can’t really do it justice in this post. I just want to make sure you are aware of it.

If you do choose to use userContent.css or userChrome.css, I would suggest the methods I talked about in my earlier post on autoconfig. Then you don’t have to mess with the default profile.

Modifying the default profile can be a handy way to set some defaults for your user, but remember that these files are only used when a new profile is created.

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 *

99 thoughts on “Customizing Firefox – Default Profiles

  1. I didn’t know about the omni.jar file. To set a default browser window size, I’ve always just copied a localstore.rdf file into the defaults/profile directory at the same level as the firefox binary (/Applications/Firefox.app/Contents/MacOS/defaults/profile on OS X), creating the directories as needed.

  2. Michael I’ve not followed these customize Firefox posts closely but it appears there’s been roughly half a dozen of them so far, all covering different, sometimes perhaps relatively obscure, ways to customize Firefox. Whilst this is great for documentation and immediate assistance purposes, does it not also highlight a very chunky hole in Firefox’s corporate deployment customizability? How many of your tips are available through the CCK? Shouldn’t they all be if they are not? Well, if not the CCK, then a new one-stop customization tool of another name with a new marketing focus? It appears that your posts – whilst very helpful I’m sure – really just add weight to the aggravation expressed by users that generated the deployment of the ESR release, yet no followup seems to have been made with the client deployment issues that were raised except your posts. I sense a tool is necessary! How about looking at combining the CCK, Mozilla Profile Manager and all the tips and tricks you’ve outlined, into one Firefox Deployment Kit (to coin a name) ?

    • You’re stealing my thunder.

      My last post is going to be about how the CCK fixes everything 🙂

      Seriously, you’re absolutely correct.

      What’s really needed here is what Netscape used to produce – the Mission Control Desktop.

      • Sorry about that 🙂

        Look forward to reading your posts.

        Never heard of the Mission Control Desktop. Sounds very interesting. I hope something emerges because all I saw at the time of the kerfuffle from corporates about deployment was some bug traffic about Microsoft Installer (msi) binaries. That may well be a useful option but I doubt it covers everything that you’ve outlined.

  3. I tried to add certificates by copying a cert8.db file to defaults/profile in Thunderbird 10, but it does not work.

    Is there any hint what may be wrong?

    • I would start by putting a test file in the directory and making sure it gets copied over to the new profile.

      Then move up to DBs. I think you might need to put all .db files in there, not just one of them (they depend on each other).

  4. I’m deploying FF in a corporate environment. I want to have a bookmark folder and customize the button layout for our user. I have the custom localstore.rdf and bookmarks.html. Do I copy these file back into C:\Program Files\Mozilla Firefox\omni.ja or do I open up the firefox-setup.exe and replace that omni.ja. You say that firefox copies defaults/profile from the install location. I only see C:\Program Files\Mozilla Firefox\defaults\pref. On a tangent can these setting be applied if the profile is already created.

    • You would create a new directory, defaults/profile and put the files in there.
      Don’t mess with omni.ja.
      Then they will happen with new profiles.
      Modifying existing profiles is more difficult (especially localstore.rdf). You could use the CCK to modify the bookmarks.

      • Hi Mike,
        i know this post from 3 months ago, but actually it does not work with me.
        i want to customize the bookmark Firefox 10, i create a new directory but No luck, any suggestion ? thank in advance.
        Regards

  5. i just want to have firefox open in a fixed location with a fixed window size every time it opens, regardless of the last window size & position when it was closed.

    looked into prefs.js in the default profile directory, was pointed to “http://www.mozilla.org/unix/customizing.html#prefs”, but no luck 🙁

    Any ideas how this can be done?

    • My only thought off the top of my head is to make localstore.rdf read only, then Firefox won’t persist any changes…

  6. Hi Mike,

    You say:

    > Copy the files you want to modify into the directory defaults/profile underneath where the Firefox executable is located (you’ll have to create this directory). When a new profile is created, these files (and any other files that are also in the directory) are copied over.

    … which works brilliantly, but I’ve found that when Firefox upgrades[1] it deletes the prefs.js and localstore.rdf files it finds in the “\defaults\profile” folder.

    The prefs.js being deleted is no problem of course as the “defaultPref”s can go in the firefox.cfg (or equivalent) file. But what to do about customisations in the localstore.rdf file, if it only gets deleted when FF upgrades?

    Many thanks,
    Darren.

    [1] I’ve been testing with 16.0.1 upgrading to 16.0.2

    • This would actually be a Firefox bug.

      A Firefox upgrade should not modify files that the user has put in the directory.

      Are you on Mac or Windows.

  7. Hi
    Great Article , im currently trying to deploy firefox with some defaults pref’s and now using the userChrome i can remove the home button etc.
    However is there anyway to set the default location of the default profile. for example its currently set as ~/Library/Application Support/Firefox. could i chnage this so its in ~/Library/Preferences?
    or another other location under the users profile?
    could the name be changed also?

    thanks

    • You can’t specify the default location of all profiles, but you can specify the default location of a particular profile.

      If you start Firefox with

      -profile FULLY QUALIFIED PATH

      It will put the profile for that instance into that directory.

  8. I have FF 17.0.5 ESR installed in a VMware View environment. I would like to know if its possible for the user profile to be created on a network share (instead of %appdata%\Mozilla). I understand how to move the profile after the fact but there must be a way to change the default location. I have reviewed this post and Google and cannot find any information on how to do this.

    thx

    • There’s no way to change the default location for all profiles, but you can start Firefox with a directory and it will put the profile into that directory. So:

      firefox -profile “Z:\foo”

      This only changes the profile for that instance of Firefox, though, so every time you start Firefox you would need to pass that path.

  9. I used the defaults/profile to copy cert8.db for all users.
    But after update 21 it simply stopped working.

    Do you know if the firefox team changed things ?

    Thanks.

  10. Hi Mike,

    I have a question:
    Using Firefox 22.0, I have unzipped the omni.ja-file, but there is no “default/profile”-folder. The only folders I found in “default” are “autoconfig” and “pref”.
    Where are the files you have mentionned above? Where can I make the changes?

    Thanks,
    Markus

  11. You write: “If you add additional files into this directory, those files are copied into the default profile along with the rest of the files. This is most commonly used if you want to have default certificate databases.”

    This seems no longer to be true. In current versions the omni.ja no longer contains the path defaults/profile, and when I install FF on a server share and create this path and put there a file cert_override.txt, it will be completely ignored. This worked with former versions, but afair no longer since V22.

    Do you know any other way to deploy the cert_override.txt into newly created profiles?

    • You shouldn’t be putting this in omni.ja.

      You should create a defaults/profile directory in the same directory as Firefox (assuming you really mean Firefox 12).

      Starting with Firefox 21, they go in browser/defaults/profile

  12. Not sure if I missed the boat here or not…but with FF 24.5, there is no ‘bookmarks.html’ in the user’s profile. All bookmarks are placed in a “places.sqlite-shm” file. So i found the placing of bookmarks.html under the same folder as the exe a little miss-leading as the bookmarks file in particular is not copied – it’s imported.

    I tried the CCK add-on and FF 24 does not support that type of add-on when I tried to install it. Apparently you need to have a website host your add-on for it to work.

    I also found editing the default bookmarks.html file from “omni.ja[r]” to not be so easy. Apparently there are some cryptic ID’s assigned to all of the default bookmarks and if you do not add it correctly, it is not imported or added. In short, I could not get it to work. I managed to hack Chrome in a manner which allowed me to add bookmarks and install a non web-hosted extension but not Firefox! Hope you can help.

    Appreciate the blog!

    Kind Regards,

    Mark

    • You are correct that there is no bookmarks.html, but the initial set of bookmarks for a new profile is created from a bookmarks.html file. So if you place a bookmarks.html in defaults/profile, any new user will get those bookmarks. That’s what the post was about.

      As far as the CCK goes, I’m not sure what you mean. The CCK itself works fine in Firefox 24, and you don’t have to install the add-on from the web. You can just drag and drop the XPI into Firefox or install it using any of the mechanisms documented here:

      http://mike.kaply.com/2012/02/09/integrating-add-ons-into-firefox/

      As far as omni.ja goes, I definitely recommend not editing that file. See http://mike.kaply.com/2013/05/06/dont-unpack-and-repack-omni-jar/.

      You only need to unpack it if you want to get at the default bookmarks.htm file.

      If all you are trying to do is default bookmarks, a bookmarks.htm file in browser\defaults\profile is the way to go. If you want to do more than that, I recommend the CCK2.

      • So if I remove a user’s profile “c:\users\%USERNAME%\AppData\local\Mozilla” and remove “c:\users\%USERNAME%\AppData\Roaming\Mozilla” and place a file called ‘bookmarks.html’ in “c:\Program Files (x86)\Mozilla Firefox\defaults\profile”, then when the user runs Firefox for the first time, it will copy/import those bookmarks? I tried exporting bookmarks from both Firefox and IE into a ‘bookmarks.html’ and so far it does no importing when the users Mozilla profile folder is created. I may be doing something wrong.

    • Hello ..

      I’m trying to customize Firefox 24.6 .. when I installed it and copied the firefox files, edit some setting and re-build the package using “Microsoft Visual Studio” i got an error “Couldn’t load XPCOM”

      I did the below:
      – Add “override.ini” file in the firefox.exe directory.
      – Add “local-settings.js” file to the /defaults/pref directory.
      – Add “firefox.cfg” file (It’s the same name in the “local-settings.js” file) in the firefox.exe directory. (This file includes all the settings changes i want)

      Does anyone knows how to fix this error?

      Thanks,

      • It sounds like you’ve copied the files into the wrong directory.

        What do you mean by “copied the Firefox files”

  13. I need to add cookie and popups exceptions for 6 websites without making any other changes to existing Firefox install in our company. I have not see a way to edit an existing preference file. Can you give me some help on how I can do this from inside our program install so that Firefox will allow our web sites to use cookies and popups?

  14. Great post! However I have an issue with the “mimeTypes.rdf”.
    Using FF 24.5.0 ESR, it seems that it does not get copied into new profiles from the browser/defaults/profile.
    Instead another default version is put there. After reading your post I guess that it originates from the “omni.ja”. I have not yet managed to unzip that to verify my suspicions, but that’s a sidetrack.
    I wonder if this is a bug or some path left behind in the refactoring when they moved defaults/profile to browser/. The reason I suspect this is that if I delete mimeTypes.rdf from an existing profile THEN it gets copied in from b/d/p on the next start of FF.
    So the question here is if you have seen this too or can verify or debunk(is that the right word?) it somehow?

    Also I’m curious if CCK2 features modifications of the mimeTypes handling?

    • I’ve tested this exact scenario recently and it is working for me. Were you definitely not seeing the new mimeTypes.rdf at all or where there specific problems with a particular mime type?

      • hmm.. it may be a particular mime type (application/pdf). I tried again starting ff after deleting mimeTypes.rdf from the profile, with and without a mimeTypes.rdf in browser/defaults/profile/
        -with I get a new mimeTypes.rdf in the profile with only the application/pdf mime type, but with different properties than those set in my default.
        -without I get a new mimeTypes.rdf in the profile with many schemes set in addition to the application/pdf mime type
        What I want is the default action for pdf to be to open with system default application. This seems to work if I have NC:useSystemDefault=”true” in the :handler: tag in mimeTypes.rdf in the profile, but what I get is NC:handleInternal=”true” instead. *sigh*

        For some reason, now I’m not able to reproduce the case where the file actually was copied (marked THEN in the post above), I wonder if this could be influenced by some about:config setting, like pdfjs.disabled, that I have played around with… I guess I’ll have to try a fresh install again… 😛

        • > hmm.. it may be a particular mime type (application/pdf)

          I thought you were going to say that. The behavior is influenced by pdfjs.disabled. If you have pdfjs.disabled set to false, it ignores the flags in the mimeTypes.rdf. Quite frustrating.

          so if you want to modify mimeTypes.rdf for PDFs, you have to turn off pdfjs.

  15. Love the articles!

    This may be a bit off-topic, but is there a way to get FireFox ESR to install silently and not prompt the user to reboot at the end?

  16. Hello,

    I ‘m customizing firefox 24 , and i need to modify the bookmarks. In the previous version i worked on was firefox 17.0 the bookmarks were in the omni.ja file and i was able to modify them after extracting the omni.ja file. but in this version of firefox 24.6.0 there is no bookmarks.html file in the omni.ja file.
    I want the Bookmarks to show up direct after completing the installation and opening the browser.

    When I added the bookmarks.html file into the “defaults/profile” directory where Firefox is installed but what i get is “Import Wizard” popup to Import Options, Bookmarks, history, passwords and other data.

    How can i do this ?

    Thanks in advance .

    • You’ve done the right thing. The problem is that now you need to prevent the import wizard from coming up.

      To do that, create a file called override.ini and put it in the browser subdirectory under the firefox EXE.

      It will contain:

      [XRE]
      EnableProfileMigrator=0

      • Thanks for the help. I have created that file but the mistake I did that the file should be in the “browser/.. ” directory (As you mentioned in one of your articles 😉 ) now it’s working fine 🙂

        I have one more question here. I changed the default links of the “bookmarks.html” file with the ones i need but still the “Most Visited” button displays in the Bookmark toolbar even when i have removed all firefox links (I want only to show my Bookmarks link without “Most Visited” note that the Most Visited link open the links that I opened before).

        Can you help me with this ?

        Thanks,
        Amira

        • Also I want to do the same Bookmarks changes on the MAC Firefox 24.6 version.

          How can I do that ? (Edit and add it to the Firefox setup file)

          Thanks in Advance. 🙂

          • You can just modify the files in the Firefox.app file the same way you do on Windows. Then zip that or create a disk image,

        • Most Visited is controlled via a preference. If you set the preference “browser.places.smartBookmarksVersion” to -1 before the profile is created, those bookmarks won’t be created.

          Your only other alternative is to use something like the CCK2.

          • I tried to set “browser.places.smartBookmarksVersion” to “-1” in the firefox.cfg file but the “Most Visited” button still displaying, plus my Home page removed and the Welcome to Firefox return back to be the Home page.

            Is there another way to remove it ?

        • The CCK2 does support this. If you go to AutoConfig only, you’ll see an option to turn off the importer. In that case, I lay down the override.ini for you.

  17. <>

    hi …

    Windows user. im migrating from ff3.5 to ff12.

    ff3.5
    if profile doesnt exists then new profile copied from “<ffdir>\defaults\profile”
    if xpi file(s) exists in “<ffdir>\extensions\” it will be extracted into userprofile (it will consume more space)
    if xpi already extracted in “<ffdir>\extensions\”, then it will be not copied into “%appdata%\Mozilla\Firefox\Profiles\<random>\extensions\”

    ff12
    if profile doesnt exists then new profile copied from “<ffdir>\defaults\profile” (if exists) (editing “prefs.js” inside “omni.jar” will have no effect on initial (1st) run)

    HOWEVER …
    if xpi already extracted in “<ffdir>\extensions\”, when initial … all extensions in “<ffdir>\extensions\” is disabled, having too many extensions cause painful to set it enable 1by1 (click by click).
    QUESTION : how can we enable all extensions in “<ffdir>\extensions\” when 1st initial run ? is there config.file should i edit (eg:pref.js) ?

    im sorry for bad english, but im sure you understand about my question

  18. Customizing the permissions.sqlite file for custom popup blocker exceptions.

    moving a customized permissions.sqlite into C:\program files (x86)\mozilla firefox\defaults\profile did not replicate into a new user

      • Im scratching my head with popup block exception (2 websites to add for a company), and i will need to switch back to IE if i dont find a way…

        Any clue about how to customize this (whitelist for popups) for all profiles (new and existing?), only way i found was with sqlite3.exe and insert (in logon.vbs) but way too touchy..

        any advice appreciated

          • I have no clue about autoconfig at the moment, i am using a mozilla.cfg to set prefs (default/lock)

            I looked all over the internet but no info on how to add exceptions in popup blocker for new and existing users, except modifying permissions.sqlite (which is kinda too touchy)

            Any info would be very valuable for me, tx

            • That’s AutoConfig, so you’re good to go.

              Add this to your autoconfig and you’ll be good to go:

              Components.utils.import(“resource://gre/modules/Services.jsm”);
              Components.utils.import(“resource://gre/modules/NetUtil.jsm”);
              Services.perms.add(NetUtil.newURI(“http://YOURDOMAIN”), “popup”, Services.perms.ALLOW_ACTION);
              Services.perms.add(NetUtil.newURI(“https://YOURDOMAIN”), “popup”, Services.perms.ALLOW_ACTION);

              • wow, thanks a lot for that, will try asap

                Im using firefox 38 or 39 in production (kinda ‘afraid’ of last updates), is it still valid or do i need to update to last version first ?

                if i can get back to you i will 😉

                  • Hi Mike, I’ve added the lines of code you listed above and the exceptions are still not showing up? I’m using Firefox 36 (this is the version I am forced to use, no options). Any ideas? Here’s my lines added to the mozilla.cfg file:
                    //Firefox Default Settings

                    // set Firefox Default homepage
                    pref(“browser.startup.homepage”,”http://stores.maurices.com”);

                    // disable default browser check
                    pref(“browser.shell.checkDefaultBrowser”, false);
                    pref(“browser.startup.homepage_override.mstone”, “ignore”);

                    // disable application updates
                    pref(“app.update.enabled”, false)

                    // disables the ‘know your rights’ button from displaying on first run
                    pref(“browser.rights.3.shown”, true);

                    // disables the request to send performance data from displaying
                    pref(“toolkit.telemetry.prompted”, 2);
                    pref(“toolkit.telemetry.rejected”, true);

                    //Popup Settings
                    Components.utils.import(“resource://gre/modules/Services.jsm”);
                    Components.utils.import(“resource://gre/modules/NetUtil.jsm”);
                    Services.perms.add(NetUtil.newURL(“http://www.mysite.com”), “popup”, Services.perms.ALLOW_ACTION);
                    Services.perms.add(NetUtil.newURL(“https://www.mysite.com”), “popup”, Services.perms.ALLOW_ACTION);

      • We’re deciding to work around the problem by making a “shell” profile on all local user profiles that don’t already have a Firefox profile. Basically we know where those files are supposed to end up so we’ll just put them there for Firefox to pick up when it’s launched. It probably won’t work forever, but then again neither did this method.

  19. Mike:

    I’ve got a customized mimeTypes.rdf, but in Firefox 45 I don’t know where to put it for new profiles to pick it up.

    Is there an easy way with the CCK2 to import that file so new profiles have it by default?

    Thanks,
    Lukasz

    • In Firefox 45, you can still put it in default/profiles.

      For Firefox 46, I did just update the CCK2 so that default/profiles still works.

  20. Hi Mike, since we can’t customize the default profile anymore I tried CCK2 with the AutoConfig file. It works great for the current user log in at the time of Firefox installation. But if I log in with a new user then Firefox open with an empty page with the search bar in the center. No pre configure settings are available. I can uninstall Firefox, with the same user, and reinstall it using the AutoConfig file and my settings are back. What am I doing wrong here? What do I need to do so that all users get the default settings?

    Thanks in advance for the help!

    • Can you be more specific by what you mean with “log in with a new user”?

      Do you mean on Windows?

      Is it possible there is a permissions issues with the files?

      Can you open a bug at cck.freshdesk.com and post a screenshot as well as check the error console for any errors?

      • Sorry, I just found the problem. My deployment bundle was still using my old installation files. I just updated my bundle with the AutoConfig files and it now works correctly.

        Thanks again for the help!

  21. Since this method is not longer supported since Firefox 46, is there any other way to prepopulate a new profile?

    In the past we put a cert_override.txt into the default profile, which contained all the certificates used in our company.

    We do not install Firefox on client computers, but only create a link on the desktops, which show to our central installation located on a globally accessible fileshare. Even if there is no link on the desktop, each user can connect to the fileshare and start Firefox.

    So in the past each user could access Firefox from each device, and it did work instantly without any need of individual configuration.

    But now, since Firefox 46, it seems, that I must go back into the good old ‘stone age’, and must install the certificates on each device, for each and every user… God, how cruel!

    Okay, I could propagate the certificates via Group policy – but this works for domain members only.

    Is there any way with Firefox46 (and later), to install this software centrally and to prepare it in a way, so that it can be used from every place without the need of individual configuration?

  22. Hi Mike,

    I’m trying to figure out something. I’m deploying Firefox ESR 45.1.1 through SCCM to our environment computers (whomever requests it, really) but I’m trying to set some default bookmarks. When I use the CCK2 tool, it creates the config files but when I run the scripted installer, none of the configuration changes work.

    What steps do I take to properly deploy FF out with some preset default bookmarks?

  23. Hi Mike,

    Really appreciate your website for IT folks building corporate FF deployments. Quick question for you. Looks like they’ve changed how the menuBar setting works from FF 45 to 50. Up till now I used the localstore.rdf to make this visible, but it looks like the setting is now in the xulstore.json file which I can’t seem to set on a new profile. Also, the browser\defaults\profile folder no longer copies files to the new profile.

    How do I enable the menubar for new profiles for FF 50. It also seems to get disabled during an upgrade. Thanks a million for your help.