Firefox Tweak Guide

[Page 9] Advanced Tweaking



While you can change a great deal of Firefox's behavior using the in-browser Options screens, 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 - that is the focus of this page, and I strongly suggest that you familiarize yourself with all the details here before attempting anything else in this section.



Profiles


Firefox saves all of your custom settings in a specific Profile. This profile is typically held under the following directory:


Windows XP: \Documents and Settings\[Username]\Application Data\Mozilla\Firefox\Profiles\

Windows Vista or 7: \Users\[username]\AppData\Roaming\Mozilla\Firefox\Profiles\


Note that 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: pj8faz9p.default. Each profile holds its own customized settings, and when a profile is deleted, all changes - whether made using the Firefox settings screens or by using advanced tweaking in About:Config - will be removed.


Therefore before making any of the changes in this section of the guide, you should either make a backup of your current Firefox profile, or create a new profile for the purposes of testing. Don't skip this step as it will save you a lot of frustration, as many tweaks can't be easily "undone". The simplest way of making a backup of your profile is to copy everything under the relevant \Profiles directory (as shown above) to another location. You can then "restore" this backup at any time by copying it over existing profile(s) in the same directory.



Click to enlarge

Alternatively, if you want to create an entirely new profile so that you can safely test some tweaks for example, or simply to start tweaking from scratch, you can do so by using the Firefox Profile Manager. To access the Profile Manager, first close all instances of Firefox (otherwise profile manager won't work), 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.


Remember, 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. The next time you open Firefox it will be at its default settings again.



Bookmark Files


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). Under Firefox 2, they used to be held as the file Bookmarks.html, however as of Firefox 3, Bookmarks.html no longer holds the majority of your bookmarks; they're held in the database file places.sqlite. As you make changes to your bookmarks in Firefox, automatic backups of the last five 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 'Organize Bookmarks'.

2. In the Library window which opens you can see all of your current bookmarks arranged under various folders. You can rearrange, rename or delete any of these just as you would using the Windows Explorer interface (i.e. drag and drop). In particular make sure to 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:


  • Bookmarks in .JSON format are only compatible with Firefox 3 or newer, and cannot be imported by Firefox 2 or most other browsers. Importantly, importing a bookmark file in .JSON format into Firefox will replace all existing bookmarks, not add to them.
  • Bookmarks in .HTML format are compatible with earlier Firefox versions, and can also be imported into other browsers such as Internet Explorer. Importantly, importing a bookmark file in .HTML format into Firefox will add them to the existing bookmarks, not overwrite them.

  • Regardless of the method you choose, make certain you backup your bookmarks now, and regularly in the future.


    Restoring Bookmarks


    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 last five automatic backups to the bookmarks file, follow the instructions below:


    1. Go to the Bookmarks menu and select 'Organize Bookmarks'.

    2. In the Library window which opens, click the 'Import and Backup' button, then:


  • To import from your own .JSON file, click the Restore option and select 'Choose File', then browse to the location where your file is held and select it. This will import your saved bookmarks and overwrite/replace your existing bookmarks in Firefox.
  • To import from your own .HTML file, click the 'Import HTML' option, select 'From an HTML File' and browse to the location where you file is held and select it. This will import your bookmarks and add them to the existing bookmarks in Firefox.
  • To import bookmarks from Internet Explorer or another browser at any time, follow the steps above but this time select the relevant browser listed.
  • To revert to one of the earlier automatic backups of your bookmarks, click the Restore option, then select the date of the automated backup you wish to restore. This will overwrite/replace your existing bookmarks with those in the automatic backup.

  • Note that 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. Note further that if you find your bookmarks file appears to be corrupt, follow the instructions here to attempt repair.


    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 now saved as part of places.sqlite in your profile directory, which is the same file that holds your bookmarks (see further above). 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, and although you can view the contents of this file using a text editor like Windows Notepad, most of the contents will not make much sense as they are encrypted to prevent unauthorized access - you can only see the site addresses for which details have been saved.


    If you want to back up 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.



    Cached Files


    As covered in the Settings section of this guide, the Firefox cache, also known as Offline Storage, is a location on your hard 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 hard drive as opposed to having to redownload them over the Internet. Note the cache doesn't store elements such as bookmarks, cookies, passwords etc - these are stored separately in your profile (See above). The cache also doesn't store elements from secure websites by default, clearly for security purposes.


    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 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, etc. from the cache, follow these steps:


    1. Open Firefox, type "about:cache?device=disk" (without quotes) in the Address Bar and press Enter

    2. 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 it and select 'Save as', and save as normal.


    Once again 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 Tools>Options menus. This file is automatically generated by Firefox and updated whenever you make changes in the Options menus. You should not 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:


    Firstly, 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).


    However, there is a much easier way to customize the majority of Firefox's preferences - both the readily available ones and those which are usually hidden. That method is known as the 'about:config' method and is covered separately below.


    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 and/or to another install of Firefox, or if you want to manually delete about:config entries you've changed which you no longer need or 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.



    About:Config


    To quickly and easily access a whole range of customizations and preferences for Firefox, simply open Firefox then go to the Address Bar and enter the URL "About:Config" (without quotes), 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.


    Importantly, 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 changes using About:Config cannot be "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. As always, any settings already available in the normal Firefox Options menus are best changed from within Firefox, not using About:Config or any other method.



    UserChrome.css


    This file is a style sheet which controls the Firefox interface, and we 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, so you will have to create a new text file in the \Chrome subdirectory of your relevant Profile folder (or copy and rename the existing UserChrome-example.css file already in that folder) and make sure it is named UserChrome.css. You can then edit this file with a text editor.



    UserContent.css


    As with UserChrome.css above, UserContent.css is another style sheet which controls the way in which web pages appear in Firefox. 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 in the \Chrome subdirectory of your relevant Profile folder, or copy and rename the UserContent-example.css file already in that folder and edit it.


    A range of UserChrome.css and UserContent.css tweaks are provided at the end of the Advanced Tweaking section. Note that you should close all open instances of Firefox before editing UserChrome.css or UserContent.css, otherwise your changes may not be 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.