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:
does not work.
This post should clear things up (and show you how to make it work).
So what’s 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:
From there, we can look in browserconfig.properties 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:
browser.startup.homepage browser.search.defaultenginename browser.search.order.1 browser.search.order.2 browser.search.order.3
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:
And that’s how you set the default value of the Firefox homepage with AutoConfig.