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

Natao arisiva ity resaka mitohy ity. Mametraha fanontaniana azafady raha mila fanampiana.

How do I write a script to restore all my preferences after an update?

more options

Mozilla is great at pushing out every possible new update, no matter how trivial. Every time it does, I have to reset everything.

I've been doing this since Firefox 6. I've learned to store all my about:config tweaks in a file so I can quickly copy, paste and reset them on each update. I've included the various program settings I want, too, so I don't have to think and try to remember what each one means and what I want. I use userChrome.css to set some of my display settings, but I'm not very familiar with it.

Is there some script, program, add-on, or other method to convert this time intensive restoration of my settings every month or so for all the new updates. I'd love to find some form of a "registry.reg" type file that would work on Firefox and/or Thunderbird.

If there's something out there, I'm positive a LOT of others would want it, too.

Mozilla is great at pushing out every possible new update, no matter how trivial. Every time it does, I have to reset everything. I've been doing this since Firefox 6. I've learned to store all my about:config tweaks in a file so I can quickly copy, paste and reset them on each update. I've included the various program settings I want, too, so I don't have to think and try to remember what each one means and what I want. I use userChrome.css to set some of my display settings, but I'm not very familiar with it. Is there some script, program, add-on, or other method to convert this time intensive restoration of my settings every month or so for all the new updates. I'd love to find some form of a "registry.reg" type file that would work on Firefox and/or Thunderbird. If there's something out there, I'm positive a LOT of others would want it, too.

Vahaolana nofidina

I think I finally found my answer so others can gain from it. It uses the user.js file explained at

http://kb.mozillazine.org/User.js_file . 

There are specific cautions involved. 1. A user.js file is an alternative method of modifying preferences, recommended for advanced users only. 2. A user.js file can make certain preference settings more or less "permanent" in a specific profile. . . 3. Valid preferences you've added to the user.js file are automatically copied to the prefs.js file 4. Make a backup copy of the prefs.js file before you create or edit the user.js file. 5. The user.js file is Primary, any change you make in the options and preference dialogs or via about:config will be lost when you restart your Mozilla application because the user.js entry will override it.

So be careful. Now, how is it done. It's a simple .txt file renamed to user.js and saved in your profile folder. It has two possible line - comments // and user_pref lines. Here's an example.

// Don't show bookmark icons user_pref("browser.chrome.site_icons", false);

That's it. Now, since I've researched all the preferences I can find at http://kb.mozillazine.org/About:config_entries https://github.com/search?q=firefox+preferences and various individual articles I've found over the years, and I feel after several years that I'm knowledgeable, I can create my user.js file based on my specific preference choices and use it for every update. I can use the userChrome and userContent files for setting the appearance on the screen.

Hamaky an'ity valiny ity @ sehatra 👍 0

All Replies (10)

more options

If you try to restore prefs from as long ago were part of Firefox 6 then it is likely that a lot of them are no longer present/supported in current releases and to be sure you would have to check them all regularly like via searching the source code.

There should normally no need to restore preferences after a Firefox update.

more options

No. I actually started with Firefox 6, just as a reference to several years of experience with Firefox. I've been through most situations and generally don't ask mundane questions for basic answers. That's why I ask this level of question.

Updating from simply the previous version to the present is what I have to go through every time. Frankly, I'm getting tired of it. Since I don't bother with most updated bells and whistles, using older versions is usually fine with me.

If there was a way to totally turn off updates AND the nag reminders for a year or two, that would work for me. I suspect others would be satisfied with that solution, too. So, I guess there are two questions.

1. Is there some script, program, add-on, or other method to convert this time intensive restoration of my settings every month or so for all the new updates. I'd love to find some form of a "registry.reg" type file that would work on Firefox and/or Thunderbird.

2. How do I turn off autoupdates AND the corresponding nags? It's the nags I'd like to turn off.

more options

You can stipulate manual update only (or disable updates) with a policy. You can find policies on github and searchfox.

https://support.mozilla.org/en-US/kb/customizing-firefox-using-group-policy-windows

more options

Excuse me, are you saying that there is no way, other than manual entry, to reset preferences, settings, and config elements?

Come on, someone has to know better how to get Firefox to play nice and NOT screw us over so much and so often.

Can something be done with the userChrome.css or userContent.css files?

Other help, please?

I'm continuing to research this answer. I found several sites mentioning two files, pref.js and user.js. I looked back into my four previously saved profiles and didn't find user.js. Pref.js is there in each one of them and one has 3 different sets. Comparing the most recent pref.js file to about:config it shows they seem to show the same thing. Does that mean I can make a backup copy of my tweaked personal settings in the current perf.js file and restore it for future versions when they are pushed out to us?

I realize there may be some changes, but I can compare perf.js files for future installs to find and correct differences. The problem I have is doing it with no experience. Can someone with experience with these files give me some background and suggestions, please?

Novain'i Doc t@

more options

There are two basic ways to configure preferences. One way is via a user.js file in the profile folder.

Best it to place the user.js file only temporary in the profile folder and remove/rename the file once the prefs are set. The user.js file is read each time Firefox is started and initializes preferences to the value specified in this file, so preferences set via user.js can only be changed temporarily for the current session.

Another way is using an autoconfig.cfg file in the Firefox installation folder. This allows to set the default value of a pref in addition to force/lock a specific value.

more options

I really do appreciate the technical help. I read through the links and their links.

Please check the below and comment, especially, where I'm wrong. _____________

cor-el said

One way is via a user.js file in the profile folder. Best it to place the user.js file only temporary in the profile folder and remove/rename the file once the prefs are set. The user.js file is read each time Firefox is started and initializes preferences to the value specified in this file, so preferences set via user.js can only be changed temporarily for the current session.

_____________ If this sets the perfs and they remain after the file is renamed or moved, this would be the way to go. If not, the second method should work. Clarification, please? _____________

cor-el said

Another way is using an autoconfig.cfg file in the Firefox installation folder. This allows to set the default value of a pref in addition to force/lock a specific value.

_____________ My understanding is that two files are created. autoconfig.js goes into the C:\Program Files\Mozilla Firefox\defaults\pref where the start of my Firefox is. It consists of two lines: pref("general.config.filename", "firefox.cfg"); pref("general.config.obscure_value", 0);

The second file is firefox.cfg and is placed in C:\Program Files\Mozilla Firefox\

I'm unsure of this since I always have my profiles saved on a different partition for crash and backup reasons. Should I place it in the Profiles directory? It consists of multiple lines of perfs such as: // IMPORTANT: Start your code on the 2nd line Pref("accessibility.cache.enabled",true); Pref("extensions.getAddons.maxResults",50); Pref("findbar.highlightAll",true);

I couldn't see any reference to an ending line or closure mark.

In reading I see there are multiple typs of functions, but the only ones I think I would use are: pref(prefName, value) – sets the user value of a preference. This function explicitly sets the preference as a user preference. That means that if the user has changed the value, it will get reset every time the browser is started.

lockPref(prefName, value) – sets the default value of a preference and locks it. This is the most commonly used function. Locking a preference prevents a user from changing it, and in most cases, disables the UI in preferences so it is obvious to the user that the preference has been disabled.

The only reason I can think of using the lockPref is baseed on if the normal use of pref() doesn't seem to hold, I'd try to use it to lock it in place.

Hopefully, once this is done, and I've made a backup, every time Firefox is updated, all I need to do is replace these in location and it is done, unless there is a new conflict with one one the prefs. That is usually ignored, but I can work that out.

Finally, can this work with addons, themes, and userChrome and userContent files? Not expecting technical help here, just curious.

more options

Routine automatic updates shouldn't reset all the customizations in your profile -- the only changes should be to resolve compatibility issues with the new version. Over time, some userChrome.css/userContent.css rules may break, but the rest should continue to apply as they did before the update. So it sounds like something very unusual is happening during your updates.

Do you ever see any messages from Firefox about doing a reset/refresh/tune-up or creating a new profile?

Doc said

My understanding is that two files are created. autoconfig.js goes into the C:\Program Files\Mozilla Firefox\defaults\pref where the start of my Firefox is. ... I'm unsure of this since I always have my profiles saved on a different partition for crash and backup reasons.

Autoconfig files are not profile-specific: they apply to all profiles you create/use for the same installation of Firefox. This is why they are stored in the program folder rather than a specific profile folder.

But let's discuss your profile location configuration. The current default profile path should be saved in these files:

  • C:\Users\<username>\AppData\Roaming\Mozilla\Firefox\installs.ini
  • C:\Users\<username>\AppData\Roaming\Mozilla\Firefox\profiles.ini

Note that AppData is a hidden folder. You may need: https://support.microsoft.com/en-us/windows/view-hidden-files-and-folders-in-windows-97fbc472-c603-9d90-91d0-1166d1d9f4b5

If those files are not working as expected, then Firefox will lose track of your profile location(s) and the about:profiles page (internal page added around Firefox 47) won't list all the physically available profile folders (whether they are in the default location or somewhere else).

As a starting point, could you check about:profiles and see whether that matches what you expect for your regular profile folder? Assuming it is correct, you could consider adding installs.ini and profiles.ini to your backup plan just in case Firefox is losing track of your regular profile.

more options

I haven't received any particular notifications during updates. I just find that some of the settings I have must be redone, so I end up doing them all, just to be safe.

As for location of program and profiles, I'm really old school - pre-windows, pre-DOS, using CP/M. I've found from years of experience NOT to trust the normal installation or configuration process. When I'm installing a new OS, be it the original Windows up to Windows 11, I set partitions up so that the OS goes on the primary along with the installed programs. All parts I want to retain, backup of preferences, storage of working files, etc. when I have to restart an installation due to some hang up in the entire process (Windows 11 has been really bad about this) are stored on a different partition. Hence, my initial installation of Firefox is on C:\ but I create a working profile located on a different drive. This has NEVER been a problem in the past. I've worked with the hidden files, including AppData since they came out, and they haven't been an issue for me in the past and except for this, have been working as expected this time around.

As for the location of the .js files, I haven't set them up yet. I want to get this straightened out first. My Chrome files are all placed in the Chrome folder within my profiles so they are safe from a reinstall, except when Firefox doesn't like using a profile for a previous version. Then I move them separately.

My goal is not to fix a present problem. It's to find an efficient method of restoring preferences on updates when they don't return to my normal configuration. As an example, right now I'm dealing with having to retweak my tabs settings so they are more legible. Modern themes seem to think transparent tabs work just fine no matter what the background is. I want a colored tab. But that's next on my list. I'm leaving tomorrow out of the country so things are a little time intensive right now.

So, cor-el's suggestion is best so far. I'm needing a little clarification on what I read in the links.

jscher2000, are conversant with questions I raised? Can you shed some light on answers to them? I'd appreciate the help.

more options

Vahaolana Nofidina

I think I finally found my answer so others can gain from it. It uses the user.js file explained at

http://kb.mozillazine.org/User.js_file . 

There are specific cautions involved. 1. A user.js file is an alternative method of modifying preferences, recommended for advanced users only. 2. A user.js file can make certain preference settings more or less "permanent" in a specific profile. . . 3. Valid preferences you've added to the user.js file are automatically copied to the prefs.js file 4. Make a backup copy of the prefs.js file before you create or edit the user.js file. 5. The user.js file is Primary, any change you make in the options and preference dialogs or via about:config will be lost when you restart your Mozilla application because the user.js entry will override it.

So be careful. Now, how is it done. It's a simple .txt file renamed to user.js and saved in your profile folder. It has two possible line - comments // and user_pref lines. Here's an example.

// Don't show bookmark icons user_pref("browser.chrome.site_icons", false);

That's it. Now, since I've researched all the preferences I can find at http://kb.mozillazine.org/About:config_entries https://github.com/search?q=firefox+preferences and various individual articles I've found over the years, and I feel after several years that I'm knowledgeable, I can create my user.js file based on my specific preference choices and use it for every update. I can use the userChrome and userContent files for setting the appearance on the screen.

more options

I'm sure you will, but just in case anyone else is reading, you'll want to keep a copy of your user.js file in safe location if there is a problem with Firefox clearing customizations from your profile folder(s).