Search Support

how to change the the setting "Privacy & Security - History - Clear history when Firefox closes" using mozilla.cfg

  • 4 replies
  • 1 has this problem
  • 123 views
  • Last reply by cor-el

more options

My Firefox 70.0 32-bit version is default to not clear history when Firefox closes. However, when I upgrade to Firefox 68.2 ESR 64-bit, it is defaulted to clear history when Firefox closes. How do I toggle that value in .cfg file. I want to change the config before install Firefox because changing it after the installation is not feasible. I have a lot of users to install. Thanks.

Attached screenshots

Chosen solution

The main checkbox is set using the privacy.sanitize.sanitizeOnShutdown preference. The individual items to clear are toggled using the privacy.clearOnShutdown.* preferences. For example, the privacy.clearOnShutdown.cookies will toggle cookies on or off.

As an example, if you wanted to clear only the cache and cookies when Firefox is closed and lock it so that the user can't make changes, you would need the following code:

lockPref("privacy.sanitize.sanitizeOnShutdown", true);
lockPref("privacy.clearOnShutdown.cookies", true);
lockPref("privacy.clearOnShutdown.cache", true);
lockPref("privacy.clearOnShutdown.downloads", false);
lockPref("privacy.clearOnShutdown.history", false);
lockPref("privacy.clearOnShutdown.formData", false);
lockPref("privacy.clearOnShutdown.offlineApps", false);
lockPref("privacy.clearOnShutdown.sessions", false);
lockPref("privacy.clearOnShutdown.siteSettings", false);

Hope this helps.

Read this answer in context 👍 2

All Replies (4)

more options

Chosen Solution

The main checkbox is set using the privacy.sanitize.sanitizeOnShutdown preference. The individual items to clear are toggled using the privacy.clearOnShutdown.* preferences. For example, the privacy.clearOnShutdown.cookies will toggle cookies on or off.

As an example, if you wanted to clear only the cache and cookies when Firefox is closed and lock it so that the user can't make changes, you would need the following code:

lockPref("privacy.sanitize.sanitizeOnShutdown", true);
lockPref("privacy.clearOnShutdown.cookies", true);
lockPref("privacy.clearOnShutdown.cache", true);
lockPref("privacy.clearOnShutdown.downloads", false);
lockPref("privacy.clearOnShutdown.history", false);
lockPref("privacy.clearOnShutdown.formData", false);
lockPref("privacy.clearOnShutdown.offlineApps", false);
lockPref("privacy.clearOnShutdown.sessions", false);
lockPref("privacy.clearOnShutdown.siteSettings", false);

Hope this helps.

Modified by Wesley Branton

Helpful?

more options

Thanks Wesley. I didn't realize the main checkbox using privacy.sanitize.sanitizeOnShutdown. Do you know where I can find all the settings for about:config?

Helpful?

more options

They change constantly, so there really isn't a complete list available. Some websites has attempted to keep a complete list, but all of them are outdated at this point.

I have proposed a document called Finding Firefox Preference Names that outlines the process I use, although it has not yet been reviewed by the Mozilla knowledge base team.

Basically, the way I find the preference names that I want is I open the Firefox profile folder on my computer and open the prefs.js file in there. That includes a list of all of the preferences set in Firefox. I copy the contents of the file into Notepad.

Then I make the change that I want in the Firefox settings and copy the new contents of the prefs.js file into another Notepad. Then I paste each file contents into an online text difference program to see what changed between the two configurations.

With the exception of the back-end Firefox Sync preferences, you will generally find that the preference you changed will be listed there. I'm not really sure if there is a better way to do it, but that's my method.

Other times, if I can't find the preference or if the preference doesn't get marked as changed in the prefs.js file for some reason, I will just search a keyword on the about:config page.

Helpful?

more options

Note that in this case you can easily find the name of the preference on the about:preferences page via the Web Console.

Helpful?

Ask a question

You must log in to your account to reply to posts. Please start a new question, if you do not have an account yet.