Setting the Default Firefox Homepage with Autoconfig

Recently I've seen a lot of questions around why defaultPref in an autoconfig file doesn't work to set the Firefox hompage. For example this:

defaultPref("browser.startup.homepage", "");

does not work.

This post should clear things up (and show you how to make it work).

So unique about the browser.startup.homepage preference that it's default values cannot be set like other preferences in the autoconfig file>

It is a complex preference.

Complex preferences are preferences whose default value is a pointer to a properties file that contains the value of the preference. Although when you go to about:config and search on browser.startup.homepage and see about:home as the value, that is not the true value of browser.startup.homepage. To see the true value, we can look in the configuration file for Firefox:

pref("browser.startup.homepage", "chrome://branding/locale/");

From there, we can look in to see the value:


So why is the browser homepage a complex preference? Complex preferences are used when you want to be able to translate a preference value. In the past, the Firefox homepage was localizable; that's why it ended up being a complex preference.

You need to be aware of all of the complex preferences in Firefox because if you want to set the default value of any of them, you'll need to follow the instructions I'll give later in this post. The complex preferences you'll probably care about are:


There are some other ones in firefox.js, but these are the important ones.

So here is the million dollar question; how do you set the default value for these preferences?

You can use a data URL to fake the complex preference behavior:

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

And that's how you set the default value of the Firefox homepage with autoconfig.

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 *

15 thoughts on “Setting the Default Firefox Homepage with Autoconfig

  1. Hello.
    I've tried to do what you tell in this entry of this amazing blog, but without success. Would you tell me what I'm doing wrong, please?

    I'm running Ubuntu 12.04 with Firefox 13. I've created the file /usr/lib/firefox/defaults/pref/hello.js with the line
    pref("general.config.file", "firefox.cfg");
    and I've created the file /usr/lib/firefox/defaults/pref/firefox.cfg
    with the lines
    defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=");

    But when I start Firefox, it remains the same homepage it had before (in other words, these changes doesn't work). I've tried creating a new user to see if these configurations work in a new and clean user, but it doesn't.

    Please, please, please. What I'm doing wrong??

    Thanks, thanks, thanks!!

      • Oooh, I forgot, sorry!!!
        But I've added this line to /usr/lib/firefox/defaults/pref/hello.js and there's no change. Mmmmmggghh.

        I've tried to update default version of Firefox in Ubuntu 12.04 to new Firefox 15, and I've moved my js file (hello.js) and my authconfig file (firefox.cfg) to new configuration folder /usr/lib/firefox/defaults/preferences. If I go to about:config in browser, I see that values in hello.js are correctly read, but the homepage configured in firefox.cfg still doesn't apear.

        I've noticed also that default installation of Firefox in Ubuntu comes with a file called syspref.js located at /usr/lib/firefox/defaults/preferences with a commented line like defaultPref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=");
        but I have discomment this I doesn't work either.

        I've no idea what to do now.

        Thanks for your so fast reply!!!

        • Sorry, the commented line in syspref.js file that comes in Ubuntu is
          pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=");

          not defaultPref

  2. Well, two things:

    -If a put any configuration directive in my autoconfig file (firefox.cfg), it doesn't work. It seems its a problem about locating this file, but I've put it in /usr/lib/firefox and in /usr/lib/firefox/defaults/preferences, ...I don't know other possible places...I'll investigate this.

    -If a put any configuration directive in my js file (hello.js), it works perfectly. But if I try to put in this file the homepage configuration (with "pref" directive instead of "defaultPref" and with the correct format "data:text/plain...") it doesn't work. In fact, it's what happens with the file "syspref.js" which is shipped by default with Ubuntu

    • Apparently defaultPref is broke in current Firefox builds and we are just now discovering it.

      lockPref should work though.

      you can test if your config file is working at all by putting errors in it and seeing if you get a popup.

      • Thanks.
        I don't know why, but neither /usr/lib/firefox/firefox.cfg nor /usr/lib/firefox/defaults/preferences/firefox.cfg are found. I wish "general.config.file" could admit paths...

        Other thing: lockPref works perfectly inside a my js file (hello.js). However, not only defaultPref doesn't work (as you say), but pref doesn't work neither.

        Thanks a lot

        • I point out...lockPref works well with syntax:
          Syntax with "data:text/plain..." stuff isn't recognized.
          I suppose you knew perfectly, but just in case...

  3. I have been using file to set browser.startup.homepage and browser.startup.homepage_reset but that does not seem to be working any more (Firefox 10.0.9ESR). Should I move to the method described above? Is not supported anymore?

    • only has one line in it now:


      So it's only used for the homepage (not reset).

      browser.startup.homepage_reset is not used at all anymore.

  4. Dear Mike,
    I have been looking for many hours on how to set the homepage as a _default_ that a user can change and not have it forced as an effective policy. Many blog entries and forum participants I've tripped over on my search have been flummoxed by this, but you've explained it simply and with authority.

    So: Thank you!

    Kind regards,
    Darren Collins
    IT Services
    University of Oxford

  5. For the record, I had to set also
    in my autoconfig.js file for this to work, if I not set it, I can use pref or lockPref, but not defaultPref for browser.startup.homepage