|< Day Day Up >|
Each user typically has a personal profile located in a predefined location, depending on the operating system. The following list shows the profile settings for a number of operating system platforms:
A default installation of Firefox has more than 100 files in the profile location. Most can be safely ignored; some, however, are important to us.
The characters xxxxxxxx in the previous profile names represent a string of random characters (numbers and letters). This serves a dual purpose. First, it ensures that the profile for one installation does not overwrite another profile. Second, it helps protect the profile from attacks or exploitation by rogue applications. When Firefox is installed, it creates an initial profile with an extension of .default. When you create new profiles, the extension for your new profile will be the same as the profile name and not default.
Configuration File: user.js
The main profile configuration file is called user.js. This file contains various preferences the user can set. A preference is a Firefox option. For example, the color of a hyperlink in a web page can be set with the preference browser.anchor_color.
Firefox only reads user.js and never writes to it. (When Firefox writes preference changes, they are written to prefs.js.)
The user.js file, by default, is not created by the Firefox installation process; you need to create it using Notepad or some other suitable text editor. I recommend avoiding word processing editors (such as Word) because they can leave undesirable characters and formatting in the file.
When you have a user.js file and you set a preference in it, this preference can be migrated to prefs.js by Firefox.
Preferences stored in user.js are loaded whenever Firefox is started. If user.js is modified while Firefox is running, the changes take place the next time Firefox is restarted.
All the parameters you can configure in user.js can also be set by typing about:config in Firefox's Location bar. This displays the Firefox configuration page.
Creating a user.js File in Windows
You should already know how to create a file in your operating system. However, if you are unsure of how to create and edit text files, try the following steps. Although they're written for Windows XP users, Linux and OS/X users would follow almost identical steps. Instead of using Notepad, though, they would use whatever text editor they are most familiar with:
In any .js (Java Script) file, comments can be included using the Java comment syntax: /* starts a multiline comment and */ ends the multiline comment. For a single-line comment, prefix the comment with //.
Here's an example:
/* Everything in user.js overrides prefs.js! */
This line inserts a comment in the file, which Firefox ignores. Comments are useful as reminders of why (or perhaps how) you made a given change. I recommend that each line you add to your user.js include a corresponding comment line that specifies why you added the line and what the default value was.
Customizing Firefox's Look and Feel with userChrome.css
The userChrome.css and userContent.css files contain CSS rules to describe how things should appear. Chapter 15, "Creating Your Own Theme," goes into more detail about Cascading Style Sheets. Additionally, if you want to become a CSS expert, visit the W3C website (http://www.w3c.org) and read the specifications for CSS.
The sample userChrome.css file has only a few sample settings. But many more settings are possible in userChrome.css.
Customizing How Content Is Displayed with userContent.css
To modify the default display of web content, use the userContent.css file. The layout and syntax of userContent.css is identical to userChrome.css, as discussed previously.
As you might expect, a useful extension for Firefox is available that edits the userChrome.css, userContent.css, user.js, and prefs.js files. This editor, named ChromEdit, is a simple text tool with tabs for each of these four configuration tools.
Keep in mind that, if prefs.js is edited and saved using ChromEdit, Firefox overwrites any edits you saved.
Prior to making wholesale changes to prefs.js or any other Firefox configuration file, you should make a backup copy. Doing this enables you to recover if you change something that prevents Firefox from running.
The ChromEdit utility can be installed from http://www.extensionsmirror.nl/index.php?showtopic=21 (see Figure 4.1). Once installed, a new menu item Edit User Files is installed in the Tools menu.
Figure 4.1. The ChromEdit editor window with the profile files opened.
|< Day Day Up >|