Firefox Tweak Guide
[Page 9] Advanced Tweaking
While you can change a great deal of Firefox's behavior using the normal Options, as well as customizing various features through the use of Add-ons, there are even more ways in which you can fine-tune Firefox to better meet your needs. This section of the guide deals with such advanced tweaking. It's a bit trickier than the tips covered earlier in the guide, but proper knowledge of advanced tweaking gives you even more control over various hidden features within the browser.
Before undertaking any tweaking however, it is vitally important that you understand Firefox's structure and where it stores different types of customizations, as well as the different methods by which you can apply various customizations and tweaks, and how you can protect yourself against unintended changes. I strongly suggest that you familiarize yourself with all the details here before attempting anything else in this section.
Firefox saves all of your custom settings in a specific Profile. The profile(s) are typically held under the following directory:
Windows XP: \Documents and Settings\[Username]\Application Data\Mozilla\Firefox\Profiles\
Windows Vista, 7 or 8: \Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\
If you can't see the directory path above on your system, you will need to enable the 'Show hidden files and folders' option found under the View tab of the Folder Options item in Windows Control Panel. Each profile directory is named with a string of letters and numbers, followed by the actual profile name. For example, the original profile in Firefox is called Default, so your profile directory's name may look something like this: pj8fzz9p.default. Each profile holds its own customized settings, and when a profile is deleted, all the changes that you have made - whether made using the Firefox Options, or by using Extensions, or via advanced tweaking in About:Config - will be removed.
Backing Up & Restoring Profiles
Before making any of the changes in this section of the guide, or for the purposes of migrating all of your Firefox settings, tweaks and other alterations quickly and easily to another installation of Firefox, you can backup your profile. To do so, go to the relevant \Firefox\Profiles directory as listed further above. Then open your specific profile folder that begins with a string of numbers, followed by .default. This folder contains a number of subdirectories and files which hold all of your Firefox settings, passwords, bookmarks, extensions, etc. Copy your profile folder (starting with a string of numbers and ending with .default), and save it somewhere safe, as it contains secure information.
To restore your profile, say to a new installation of Firefox you have made on a fresh reinstall of Windows, first launch Firefox at least once so that it creates a default profile folder. Now navigate to the \Firefox\Profiles directory, and rename the default profiles folder to something else, such as from pj8fzz9p.default to pj8fzz9p.BACKUP. Then copy your backed up profile folder to the same \Firefox\Profiles directory, and rename it so that it has the same name as the existing default directory before it was renamed (i.e. pj8fzz9p.default in this example). When you next launch Firefox, you will see that all of your customizations have been restored.
To create an entirely new profile so that you can safely test some tweaks for example, or simply to start from scratch, you can use the Firefox Profile Manager. To access the Profile Manager, first close all open instances of Firefox, then go to Start>Run and type "Firefox.exe -profilemanager" (without quotes) and hit Enter. This will open up the Profile Manager dialog box, and from here you can create a new profile, or delete or rename existing profiles. Note that if the 'Don't ask at startup' box is unticked, then every time Firefox opens, and if you have two or more profiles, it will first open the Profile Manager so you can select which profile to use. This is not normally required, so the box should remain ticked.
If you just want to restore Firefox back to its original default settings at any time, you can use the profile manager to first create a new profile (which automatically uses the default settings) then double-click on that new profile name to use it in Firefox.
New to Firefox 13.0, you can now also easily create an entirely new profile and migrate your most important data (i.e. bookmarks, passwords, history, etc.) to it. To do this, type 'About:Support' (without quotes) in the address bar. In the page that opens, click the 'Reset Firefox' button to commence the process.
In Internet Explorer your bookmarks are better known as Favorites, and are stored under the \Documents and Settings\[username]\Favorites\ directory in XP, or \Users\[username]\Favorites in Vista or 7. In Firefox, your bookmarks are held under your Firefox Profile folder (see above). They're held in the database file places.sqlite. As you make changes to your bookmarks in Firefox, up to 10 automatic backups of the changes are also held under the bookmarkbackups folder under your profile directory. In general you should not edit or alter these files directly - follow the directions below if you want to backup or restore your bookmarks. Backing up bookmarks is particularly important before commencing any tweaking:
Backing Up Bookmarks
1. Go to the Bookmarks menu and select 'Show All Bookmarks'.
2. In the Library window which opens you can see your current bookmarks under the 'Bookmarks menu' folder in the left pane. You can rearrange, rename or delete any of these just as you would using the Windows Explorer interface. Also check under the 'Unsorted Bookmarks' folder and if necessary allocate bookmarks from there to your other folders.
3. Once done, to back them all up click the 'Import and Backup' button in the Library.
4. You can select to backup your bookmarks as a .JSON file by clicking the Backup option, or as an .HTML file by clicking the 'Export HTML' option. In either case this file will contain all your current Firefox bookmarks for the active profile, however it is important to note the difference:
You can backup your bookmarks in one or both formats, but regardless of the method you choose, make certain you backup your bookmarks now, and do so regularly in the future.
To restore or import bookmarks at any time, whether from Internet Explorer, an existing Bookmarks.html file, a .JSON file, or from one of your automatic backups to the bookmarks file, follow the instructions below:
1. Go to the Bookmarks menu and select 'Show All Bookmarks'.
2. In the Library window which opens, click the 'Import and Backup' button, then:
The automated bookmark backups which Firefox keeps are held as .JSON files in the \bookmarkbackups folder under your profile, in case you want to manually back them up to another location. If you find your bookmarks file appears to be corrupt or inaccessible, follow the instructions here to attempt repair.
Once again, because the permanent loss of your bookmarks can be such a frustrating and annoying event, make absolutely certain to back them up regularly, and definitely back them up before engaging in any advanced tweaking.
Cookies, History, Saved Passwords
Cookies: Firefox stores your cookies in the automatically generated file cookies.sqlite under your specific Profile folder. This is a database file and should not be manually edited.
History: Your browsing history is saved as part of places.sqlite in your profile directory, which is the same file that holds your bookmarks. It should not be manually altered.
Saved Passwords: Your saved website login and password details are kept in the file signons.sqlite file in your profile directory. This is a database file which should not be manually altered. Its contents are encrypted for security purposes; you can only see the site addresses for which details have been saved, not the actual login/passwords themselves.
If you want to back up and restore any of these individual files, I strongly suggest backing up your entire profiles folder, rather than these individual elements, as there are several other files which are required to make a profile function correctly. If you simply want to import cookies, history or username/passwords from another browser such as Internet Explorer, you can use the Import option found under the File menu in Firefox.
As covered in the Settings section of this guide, the Firefox cache, also known as Offline Storage, is a location on your drive where Firefox stores website elements such as images, text, ads etc. This cache speeds up browsing because when you revisit sites, the stored version of the unchanged elements are loaded from the cache on your drive as opposed to having to be downloaded from the Internet. The cache doesn't store elements such as bookmarks, cookies, passwords etc - these are stored separately in your profile (see above).
The location for cached Firefox web elements is under the \Documents and Settings\[Username]\Local Settings\Application Data\Mozilla\Firefox\Profiles\[profilename]\Cache directory in Windows XP, or \Users\[username]\AppData\Local\Mozilla\Firefox\Profiles\[profilename]\Cache in Windows Vista or 7. However the files held there are saved under multiple folders as a range of alphanumeric strings and not as filenames. This is primarily for security purposes, so that a malicious file/script in your cache can't be launched easily.
If you want to view and retrieve a particular image, document, flash animation, vdeo, etc. from the cache, follow these steps:
1. Open Firefox, type 'About:Cache' (without quotes) in the Address Bar and press Enter.
2. Select 'List Cache entries' under the Disk cache device - this are the files stored on your drive.
3. Depending on the cache size and your drive speed, it may take a while to list all the cached entries on your drive. All the cached entries will be shown as standard web links. Press F3 or CTRL+F to open the Search box if you wish to search for the relevant site/element.
3. Once found, click once on the link to open it up on a new page. A range of detail about the file will be shown.
4. If you still want to go ahead and view the actual item, click the link at the top of this page and it will be displayed as it normally would in the browser. I strongly recommend that you do not do this for any executable files such as .bat, .com, or .exe, unless you are 100% sure of the source.
5. If the item is something you wish to save, right click on the link instead and select 'Save Link As', and save the file as normal.
There is an element of risk involved in opening cached elements in this manner, however given the reasonably robust defences in Firefox, the chances of finding malicious software in your cache is minimal. Just make sure to scan any files retrieved in this manner with a malware scanner, just in case.
Prefs.js & User.js
There is a file called Prefs.js in each profiles folder which holds most of the Firefox preferences you set in the Firefox Options menus, as well as those you manually change or add in About:Config. This file is automatically generated by Firefox and updated whenever you make changes to Firefox's configuration. Typically you won't need to manually edit this file. Instead, if you want to add customized preferences to Firefox outside of those available in the Options menus, there are two preferred ways in which you can do this:
1. You can create a new file in the same directory as Prefs.js called User.js. To create this file, open Windows Explorer, go to your Profiles directory, and under your current profile's directory - in the same directory as Prefs.js - right-click in an empty spot in the right pane and select New>Text Document. You can now edit this file using a basic text editor like Windows Notepad and manually insert commands in the file. Once done, right-click on the text document and rename it to User.js (not User.js.txt). Any preferences set in this file will override those in Prefs.js.
2. A much easier way to customize the majority of Firefox's preferences - both the readily available ones and those which are usually hidden - is via the About:Config method, which is covered separately below and on the next page.
The main uses for Prefs.js and/or User.js would be if you wanted to backup or copy across your custom Firefox configuration or tweaks to another machine or to another install of Firefox, or if you want to manually delete About:Config entries you've manually added but no longer want. Note that if you want to edit Prefs.js and/or User.js you should always close all open instances of Firefox first before opening either of these files in a text editor, otherwise your changes will not be properly saved or implemented in Firefox.
To quickly and easily access a whole range of advanced customizations and preferences for Firefox, simply type 'About:Config' (without quotes) in the Address Bar then press Enter. After accepting the warning prompt shown, Firefox displays a large range of preferences sorted alphabetically. We cover all the major preferences, both those which are already shown under About:Config, and some which will need to be created by the user, starting on the next page of this guide.
Any changes made using the About:Config method are stored in the Prefs.js file in your Profile folder as mentioned further above. It is recommended that you backup this file before using the About:Config method as a precaution, because some changes to About:Config cannot be easily undone without restoring or editing the Prefs.js file. If you didn't backup the file before making changes, you can manually edit Prefs.js with any text editor to remove the line(s) containing the altered preference(s) you don't want, and it will be reset back to its default. Any settings already available in the normal Firefox Options menus are best changed from within Firefox, not using About:Config or any other method.
This file is a style sheet which controls the Firefox interface, and users can insert various commands into it to modify the way Firefox looks beyond the settings available in the Options menu. This file doesn't normally exist in your Profile folder, and as of Firefox 4.0, neither does the \Chrome subdirectory of your Profile folder which it normally sits under. Go to your profile folder as listed at the top of this page, and create a new subdirectory called Chrome. For example, under Windows Vista/7 it the full directory path should look like this:
Now under this folder, right-click in an empty space and select New>Text Document, and rename it to UserChrome.css (not UserChrome.css.tx). You can now edit this file with a text editor and add custom code as desired.
As with UserChrome.css above, UserContent.css is another style sheet which controls the way in which web pages appear in Firefox, not the Firefox interface itself. This file also doesn't exist by default in your Profile folder, and you will have to create a new text file and call it UserContent.css under the \Chrome subdirectory of your relevant Profile folder (which you must also create, as covered above).
A range of UserChrome.css and UserContent.css tweaks are provided at the end of the Advanced Tweaking section on page 12. Note that you need to close and restart Firefox before changes to UserChrome.css or UserContent.css are implemented.
On the next page we start looking at actual tweaks which can be applied to Firefox using the methods above, starting with About:Config tweaks.