1.2. Get Oriented
Before starting our journey, there are a few things you need to know: how to find Firefox files, how to install an extension, and how to set a preference. You don't need this information to read a web page, but it's vital for most of the hacks in this book.
1.2.1. Finding Firefox Files After Installation
After installation, Firefox puts its files in two important directories. The first is the install area, also known as the application area, which gets the general-purpose bits, such as the Firefox programs themselves. The second is the profile area, which gets user-specific information, such as bookmarks. Table 1-1 lists the default locations of these two areas on different operating systems.
Feel free to have a (careful) look around in these directories.
1.2.2. Installing an Extension
Extensions are small enhancements to Firefox that are added optionally and separately to the main browser install. Just as plug-ins, such as Apple's QuickTime, enhance the display of web pages with special content, extensions enhance the display of Firefox's user interface with extra commands and extra windows. You install an extension when you need an extra feature.
You can install extensions from the official http://update.mozilla.org web site or from any web site that offers a .xpi file. Such files almost always hold one extension each.
If you choose to install an extension, you are acting like a power user rather than a beginner, so you have to use your judgment to decide what extensions will be useful to you. It's no use complaining that Firefox is too complicated if you have 10 or 20 extensions installed. Just remove them and resimplify your life.
126.96.36.199 Installing from update.mozilla.org
The Advanced Search Button extension (found in the Search Tools category at http://update.mozilla.org) is a harmless extension to experiment with. Here's how to get it.
After browsing to it on the update site, click on the matching install link. Sometimes there's a brief pause, and then Firefox presents an acknowledgement window. After another brief pause, Firefox enables the buttons in that window, asking you whether to proceed. In this case, go ahead.
Once the user agrees, Firefox downloads and installs the extension. If you choose ToolsExtensions, you'll see it there in the list, but disabled and unusable (click on it and everything is grayed out). Shut down Firefox completely and start it up again. Again, look under ToolsExtensions. You'll see that the extension is now enabled and ready to use.
The sample extension, Advanced Search Button, doesn't change the Firefox user interface much at all. All it does is offer you a new toolbar icon. Choose ViewToolbarsCustomize... to see the list of icons available. Scroll down and you'll see there's a new ASB icon there. Drag it to the navigation toolbar with the mouse. Finally, close the icon window. You can now click on the ASB button or the small triangle next to it. If you put a word in the search box and click the ASB button, the Advanced Search Button extension will search for that word in the currently displayed page.
188.8.131.52 Installing from elsewhere
By default, the Mozilla Update site (update.mozilla.org) is the only trusted web site for extensions. If you attempt to install an extension from another web site, Firefox will complain and ask you to provide extra permission. The complaint appears as a yellow information bar at the top of the page. Figure 1-1 shows this complaint for the version of the EditCSS extension that is available at http://editcss.mozdev.org.
Figure 1-1. Extension warning info bar for untrusted windows
If you click the Edit Options... button, a dialog box appears (shown in Figure 1-2), where you can add the web site to a whitelist of trusted sites. That has to be done at your discretion.
Figure 1-2. Extension web site whitelist dialog box
If the web site is added and the dialog box acknowledged, you're then sent back to the extension installation page. You have to click the extension's link a second time to restart the installation process, with trust now in place. From here, installation proceeds as explained for the Mozilla Update case.
1.2.3. Setting a Preference with about:config
A preference is a user choice that affects how Firefox runs. Firefox has hundreds of preferences. The Firefox Options Dialog box, under ToolsOptions (Windows), EditPreferences (Unix/Linux), or FirefoxPreferences (Macintosh) is the way to set common preferences. In general, though, the page shown by the special about:config URL can be used to set any preference. This process is described in detail in [Hack #23], but you need that information early. Here's a sneak peek.
All you really need to know is that if you right-click (Command-click on a Mac) in the list of preferences, you can change the preference under the mouse or add a new one. To change an existing preference, choose one of the following items from the context menu:
To add a new preference, choose the New context menu option and follow these guidelines:
After setting the preference, it appears in bold (unless you reset it). The about:config list is sorted alphabetically, so you might have to scroll a bit to see what you've added. Preference changes take effect immediately in most cases.
That's all the warm-up you need. Now, let's hack.