Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Where does Firefox temporarily store user.js settings when the file is deleted after a first run?

  • 15 replies
  • 1 has this problem
  • 1 view
  • Last reply by cor-el

more options

Hi,

I try to deploy user settings in our domain via user.js but don't want them to be forced inside the GUI. Therefore I'm saving a user.js file temporarily in the user profile, start Firefox on time, and afterwards delete the file again. Now all the settings have become part of Firefox' settings but I can't find them either in prefs.js nor in user.js. Now my question is: where does Firefox store these information? Is there an SQlite DB or somewhat different in the registry? Actually I do want to get rid of my scripting as it's kind of lacking failure tolerance and complicated.

Thanks in advance, Simon

Hi, I try to deploy user settings in our domain via user.js but don't want them to be forced inside the GUI. Therefore I'm saving a user.js file temporarily in the user profile, start Firefox on time, and afterwards delete the file again. Now all the settings have become part of Firefox' settings but I can't find them either in prefs.js nor in user.js. Now my question is: where does Firefox store these information? Is there an SQlite DB or somewhat different in the registry? Actually I do want to get rid of my scripting as it's kind of lacking failure tolerance and complicated. Thanks in advance, Simon

Chosen solution

no worries - it's not your configuration, it's always a hassle getting that right first time...

let's start it super simple - put this into the local-settings.js file within /defaults/pref:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

and then the following into mozilla.cfg that has to go into the same folder as firefox.exe (those files should probably be ANSI encoded as well):

//
lockPref("lis.a.a", 2);

does this preference show up in about:config afterwards when you launch the browser?

Read this answer in context 👍 1

All Replies (15)

more options

hi simon, i think the better way to approach setting certain preferences to a preconfigured default would be to use the method described in http://kb.mozillazine.org/Locking_preferences

you can use the defaultPref() command in mozilla.cfg to set a certain preference but still give users the option to change it. pref() would only allow user change during one session and lockPref() prohibits any change at all...

more options

Modified prefs set via user.js that no longer have the default value should be present in the prefs.js file after you start and close Firefox once.

These functions can be used in the mozilla.cfg file:

defaultPref();	// set new default value
pref();		// set pref, allow changes in current session
lockPref();	// lock pref, disallow changes

See also:

more options

Hi to both of you and thank you for your instant and helpful replies. I was not aware of the defaultprefs option so I'll definitely give it a try. Anyways I have a follow-up question: When I haven't had a mozilla.cfg file in previous installation and am upgrading to a newer release of Firefox - will the values I added be deployed to every user profile once it's loaded, only to new users, only settings not being set up before etc? I could not find a mozillazine entry describing the behavior of the mozilla.cfg file.

Thank you!

more options

the mozilla.cfg file will work independent from any profiles as it applies to the firefox executable in the installation directory with the configuration file next to it - no matter which profile it is using. so this method will have an effect for new and existing users as well and persist during updates...

more options

Thanks philipp for the explanation. That means that there is no proper way to deploy user settings one-off only for new users? To make it more clear: we have a heterogeneous infrastructure and want to have a default set of user settings deployed over the network. Sometimes these settings change but shall not be overwritten in any other case. Also, the users shall keep their ability to rewrite settings. Those personal entries shall not be touched by the default settings. Is there a way to do so?

more options

defaultPref(); in mozilla.cfg is exactly the way to do that!

more options

Hi Philipp,

Thanks for your lightning fast answer. I'm now trying to make the defaultPrefs via a mozilla.cfg file in my firefox directory and can't find a proper way to do so. I set mozilla.cfg in local-settings.js and can spot it via about:config. Sadly, all the preferences I added into my mozilla.cfg file are not present and I really do not know why. Is there a way to debug this so that I can track it down on my own or are there known issues? I tried all three options lockPref, defaultPref, and pref without any result. It seems to be the case that it either can't find the file or is unable to parse it.

Thanks a ton!

more options

can you paste the content of you current local-settings.js & mozilla.cfg files into a reply here so that we can have a look? those files are not very error-tolerant and the slightest typo might break them...

more options

local-settings.js: pref("general.config.filename", "mozilla.cfg"); pref("general.config.obscure_value", "0");

mozilla.cfg: // First line pref("lis.a", 1); lockPref("lis.a.a", "2"); defaultPref("lis.a.a.a", true); defaultPref("plugin.state.npunity3d", "1"); defaultPref("general.useragent.locale", "en-GB"); defaultPref("privacy.clearOnShutdown.history", true); defaultPref("layout.spellcheckDefault", "1"); defaultPref("spellchecker.dictionary", "en-GB"); defaultPref("privacy.clearOnShutdown.passwords", true); defaultPref("browser.privatebrowsing.autostart", false); defaultPref("datareporting.healthreport.uploadEnabled", true); defaultPref("browser.formfill.enable", false); defaultPref("privacy.clearOnShutdown.history", false); defaultPref("privacy.clearOnShutdown.cookies", true); defaultPref("privacy.clearOnShutdown.downloads", false); defaultPref("privacy.clearOnShutdown.formdata", false); defaultPref("privacy.clearOnShutdown.offlineApps", true); defaultPref("privacy.clearOnShutdown.passwords", true); defaultPref("privacy.sanitize.migrateFx3Prefs", true); defaultPref("privacy.sanitize.sanitizeOnShutdown", true); defaultPref("privacy.clearOnShutdown.cache", true); defaultPref("privacy.clearOnShutdown.sessions", true); defaultPref("network.cookie.lifetimePolicy", 2); defaultPref("pdfjs.disabled", true); defaultPref("plugin.disable_full_page_plugin_for_types", "application/pdf"); defaultPref("extensions.adblockplus.clearStatsOnHistoryPurge", "false"); // Documentation can be found here: http://kb.mozillazine.org/User.js_file // As replied in my own thread: https://support.mozilla.org/en-US/questions/1048220#answer-697528

more options

can you try removing the quotes around the integer and boolean values and see if this addresses the issue...

more options

I did but nothing changed so far. Also I tried to use a semicolon instead of a comma but this didn't address the issue either. Even after removing all except the four leading lines the configuration is not going to be parsed. Somehow Firefox ignores the whole file. I even copied the file into the defaults/pref folder but it didn't change a thing. I'm very sorry about my configuration's odd behavior!

more options

Chosen Solution

no worries - it's not your configuration, it's always a hassle getting that right first time...

let's start it super simple - put this into the local-settings.js file within /defaults/pref:

pref("general.config.obscure_value", 0);
pref("general.config.filename", "mozilla.cfg");

and then the following into mozilla.cfg that has to go into the same folder as firefox.exe (those files should probably be ANSI encoded as well):

//
lockPref("lis.a.a", 2);

does this preference show up in about:config afterwards when you launch the browser?

more options

philipp, you're a genius! Thank you so much for your efforts, it was very simple at last. ANSI encoding did the job, I saved the file via notepad++ as UTF-8 without BOM before. Maybe this should be added into the wiki?

more options

great :)) i've added that information to the wiki...

more options

general.config.obscure_value shouldn't be a String pref, but an Integer pref (i.e. no quotes around its value)

  • pref("general.config.obscure_value", 0);

EDIT:

The same for layout.spellcheckDefault and plugin.state.* prefs:

  • defaultPref("layout.spellcheckDefault", 1);
  • defaultPref("plugin.state.npunity3d", 1);

Don't know about this pref as there are string prefs with a Boolean value as you can see on the about:config page, so best is always to check the type of each pref.

  • defaultPref("extensions.adblockplus.clearStatsOnHistoryPurge", "false");

Modified by cor-el