Thursday, March 17, 2016

Firefox setting for all users - Deployment guide

Firefox is one of the most versatile browsers out there as far as being able to customize the settings for it, its huge selection of addons and its ability to shine where where other browsers like Internet Explorer and Chrome might not be as forgiving when it comes to displaying web pages.

This post is mainly going to show you in easy steps how to deploy Firefox on a machine and have global settings adjusted for all users. I will have several examples that solve annoyances that many users have experienced.

Once the configuration files are in place any new user and or Mozilla Firefox profiles that are created from that point forward will adhere to certain predefined guidelines. Also any already existing profiles will not be effected by the change.

The Download of a pre-configured file is at the bottom of this blog, there is a list of setting that are explicitly set as well.

Lets get right to it!

A couple of prerequisites to assist you in the endeavor:

1) You must be an administrator on the machine
2) Enabling file extensions is a must for this project
3) Showing hidden files and protected operating system files is helpful
4) Download Notepad++ is once again very helpful as a text editor but not required.

First lets make a New Folder somewhere for this project to keep things easy to find. We will call this your 'working folder'. Once you do that you will need to create two files with non popular files extensions.

1) Mozilla.cfg
2) local-settings.js

To make these files, open your working folder, right click and choose new, then new text file. Once one new text files is created make sure it looks something like this: New Text Document.txt. Notice the files extension '.txt' shows. Right click and choose 'rename' then change it to 'local-settings.js'. Then create another text file and do the same renaming it to 'Mozilla.cfg'.

Once you have those two files right click on them and choose edit with Notepad++. You will now be able to easily edit these files in the future if you need to make any changes. Lets start with the first file we created. The 'local-settings.js'. Right click, edit with Notepad++ or your preferred text editor.

This file is going to be a static file, and will contain only two lines. These two lines will tell Firefox that we will be using custom settings. The contents of this file is:

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

These basically tell Firefox to look for a file called 'Mozilla.cfg', and to use the setting within that file to set your choice of global setting for all users going forward on a particular machine.

The 'local-settings.js' file will be placed in the following location; of which depend on if you use the true 64 bit version of Firefox or the standard 32 bit version of Firefox. Those locations are as follows:

32 bit FireFox:
C:\Program Files (x86)\Mozilla Firefox\defaults\pref\local-settings.js

64 bit FireFox:
C:\Program Files\Mozilla Firefox\defaults\pref\local-settings.js

Next lets move on to where the magic happens which is the 'Mozilla.cfg' file. Lets edit this file now and I will show you several examples of settings that can help improve a first time users experience with Mozilla Firefox. First off the first line of the file must only contain '//'. Any additions lines containing those two '//' will be used for comment purposes only which means that they will not be read as configurations in Mozilla Firefox. Below is an example of a 'Mozilla.cfg' file with some settings designed to provide a positive experience removing any annoyances as of this writing.

//
//sets Google as the default search engine instead of Yahoo
pref("browser.search.geoSpecificDefaults", false); 
pref("browser.search.defaultenginename.US", "data:text/plain,browser.search.defaultenginename.US=Google");

// set FireFox Default homepage 

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

// Don't show Whats New on first run after every update

pref("browser.startup.homepage_override.mstone","ignore");

// disables the 'know your rights' button from displaying on first run

pref("browser.rights.3.shown", true);
pref("browser.usedOnWindows10", true);

//disable default browser check

pref("browser.shell.checkDefaultBrowser", false);

// set all plugins to always activated

pref("plugin.default.state", 2);

// hide choose what i share that pops up at the bottom of the browser after the first minute

lockPref("datareporting.policy.dataSubmissionPolicyBypassNotification", true);

// disables the request to send performance data from displaying 

pref("toolkit.telemetry.prompted", 2); 
pref("toolkit.telemetry.rejected", true);

// do not block popups - can only be default or locked pref
defaultPref("dom.disable_open_during_load", false);

// prevent reader view from popping down

pref("reader.parse-on-load.enabled",false);


// The next 3 lines shows you how to clear all browsing data/history upon close

//lockpref("privacy.sanitize.migrateFx3Prefs", true);
//lockpref("privacy.sanitize.promptOnSanitize", false);
//lockpref("privacy.sanitize.sanitizeOnShutdown", true);
// http://www.pcc-services.com/kixtart/firefox-lockdown.html
// This last line allows your browser to operate exclusively in Private Browsing Mode
//pref("browser.privatebrowsing.autostart", true);


This file will go into the following location depending on if you are 32 bit or 64 bit:

32 bit FireFox:
C:\Program Files (x86)\Mozilla Firefox\mozilla.cfg

64 bit FireFox:
C:\Program Files\Mozilla Firefox\mozilla.cfg

It is important to note here some of the settings and what they mean. We see things like 'defaultpref' lets go over them.

pref
    sets the preference as if a user had set it, every time you start the browser. So users can make changes, but they will be erased on restart. If you set a particular preference this way, it shows up in about:config as "user set". 

defaultPref
    is used to alter the default value, though users can set it normally and their changes will be saved between sessions. If preferences are reset to default through the GUI or some other method, this is what they will go back to. Appears in about:config as "default". 

lockPref
    is used to lock preferences so they cannot be changed through the GUI or about:config. In many cases the GUI will change to reflect this, graying out or removing options. Appears in about:config as "locked". Some config items require lockPref to be set, such as app.update.enabled. It will not work if it set with just pref.

clearPref
    can be used to "blank" certain preferences. This can be useful e.g. to disable functions that rely on comparing version numbers. 

It is important that not all of these prefixes can be used with every single setting. If FireFox does not launch when deploying other custom settings it is likely a bad prefix so it is a good idea to add and test you setting one by one to make sure they take. and do not cause FireFox to not start. 

A good resource is here:
http://www.pcc-services.com/kixtart/firefox-lockdown.html

Other settings you might have to hunt for. If you are familiar with 'about:config' you should know that a lot of those setting can be used in the 'Mozilla.cfg' file, but not all

Another good file to have is the 'override.ini' This file will eliminate the import wizard. More information on that is located below as well as some of what we already went over:
http://www.itninja.com/question/firefox-18-deployment-issues-config-problems

When Uninstalling Firefox, it is important to remove the files that you created and placed otherwise after the uninstall of Firefox will request a reboot to finish removing the files.

FireFox Auto download/clean install of FireFox and set up of default setting for all users


I have created two exe files that will do the following:
1) Uninstall the current version of Firefox ( either 64 bit or 32 bit whichever your choose. I recommend that IF you are on a 64 bit Windows system you use the 64 bit build instead of the 32 bit one as it is more stable and performs better ).
2) Remove any of the above mentioned files as above to allow for default setting for all users.
3) Grab the latest version of Firefox from the official Firefox Website and install it, and set setting for all users files.
4) Delete the Installer file.

There are 3 files for your viewing pleasure.

1) 64 bit beta version ( will not uninstall 32 bit versions )
2) 32 bit stable version
3) An example of the mozilla.cfg file being used if there is not one chosen ( below )

Theses installs will NOT delete any bookmarks, favorites, preferences, etc.

The mozilla cfg file is embedded in the exe with some default setting to allow you to see what setting are being used and how to do it.

IF you choose to and want to use your own configuration file, you can modify my example or you can build you own and simply place it in the same directory as the exe file is.. It is that simple.

Some of the setting I have found that works good and reduces frustration for user are:

1) set Google as the default search engine ( I simply HATE YAHOO as a search, too much spam and ads ).
2) Uses https://startpage.com as home page ( secure search engine that does not track ).
3) Don't show Whats New on first run after every update.
4) Disables the 'know your rights' button from displaying on first run.
5) Do not ask or check if Firefox is default browser.
6) Set all plugins to always activated.
7) Hide choose what i share from popping up at the bottom after about a minute.
8) Do not block popups.
9) Prevent reader view displaying on a page for the first time.
10) Set do not track.
11) Clears the cache ONLY When Firefox closes ( helps prevent cache files from creating issues and keeps clutter down on your system )
12) Disable Firefox's refresh notification. see the following articles:
http://techdows.com/2016/05/firefox-reinstall-to-prompt-for-a-refresh.html
https://support.mozilla.org/en-US/questions/1084402

As always you can create your own custom files, modify my setting and activate other setting by simply removing the // at the beginning of the lines.

If Firefox does not start after changing setting it is most likely one of the setting is set wrong or in conflict with another.

Here is the Download location for the project


August 10 2016 changes:

1) Structured code(x64)
2) Changed the way I looked for and deleted previous config files(x64)
3) Minor text changes(x64)
4) Added the following line to the cfg file(x64): pref("browser.disableResetPrompt", true);

No comments:

Post a Comment