Computerworld

15 must-have Firefox tricks

Preston Gralla reveals how to tweak, hack and bend Firefox to your will

What good is a browser unless you can tweak it, hack it and bend it to your will? No good at all. The more you can hack it, the better it is. And that means that Firefox must be a great browser. It's infinitely customizable, via editing a text file called userChrome.css, making changes via a command called about:config, and using free add-ons to extend the features of the browser.

In this article, with those techniques and others, I'll show you 15 great Firefox tricks, including how to build your own Firefox search engine, how to speed up your browsing, how to hack the interface and plenty more. So launch your favorite browser, and get ready for some great tricks.

Editor's note: If you use Internet Explorer 7 instead of Firefox, check out these 8 top tips for IE 7

1. Build your own Firefox search engine

Want to power up Firefox's search box? It's easy to create your own search engine, so that you can rifle through any site from right within Firefox. Adding a search engine that has already been written, of course, is easy. Click the down arrow to the left of the search box, select "Manage Search Engines," then click the "Get more search engines" link at the bottom of the screen. From the Web site that appears, click the search engine you want to install, and you're done.

There are plenty of sites that don't have prebuilt search engines, though. No problem: It's easy to build your own search engine. First install the OpenSearchFox add-on. Then, when you're on a search site, right-click the search box and choose the Add OpenSearch plug-in. From the screen that appears (shown below), type in the name that you want to be associated with the search engine, add a description of the search engine and click Next. Then click Finish, and the site will be added as a search engine that you can choose like any other -- by clicking the arrow to the left of the search box and selecting the engine.

Note that as of this writing, OpenSearchFox doesn't work properly with Firefox v. 2.0.0.10 or 2.0.0.11, although it may be fixed as you read this. When you use the add-on in v. 2.0.0.1 or 2.0.0.11, you'll get an error message after you click Finish, although in some instances, even if you get the error message, the search engine will still be added.

2. Use keywords to speed up your searching

Don't want to go to the trouble of adding your search engine -- or you can't get OpenSearchFox to work properly? Here's another way to do an instant search.

When you're at a site, right-click on its search box and select "Add a Keyword for this Search." Type in a name for it and an easy-to-remember shortcut (for example, hp for the Huffington Post blog site). Then click OK. Now, to search the site, go to the Address Bar, and type in your shortcut, followed by a search term, such as hp Clinton. You'll search the site, just as if you were there. Note that on occasion, the search won't work properly, but it will on most sites.

3. Speed up Firefox with pipelining

Here's a simple way to speed up Web browsing with Firefox -- turn on its hidden pipelining feature. When you turn on pipelining, you send several requests to a Web server at a time, rather than sending them one by one, so you can load multiple items on a page concurrently. By default, pipelining is turned off in Firefox, but it's easy to turn it on:

  1. Type about:config into your address bar and hit Enter.
  2. In the Filter text box, at the top of the page, type network.http. A list of settings appears, as you can see in the nearby figure.
  3. Double-click the "network.http.pipelining" setting, to change it to true.
  4. Double-click the "network.http.proxy.pipelining" setting, to change it to true.
  5. Double-click the "network.http.pipelining.maxrequests" setting, and in the text box that appears, type in 8 and click OK.

Page Break

Note that not all Web servers can handle pipelining. If for some reason, you find that your performance suffers with it turned on, reverse the above steps to turn it off.

4. Use keywords to speed up bookmarks

Visiting your favorite sites using Firefox's bookmarks is far too much of a chore -- do you really want to do all that mousing around? Instead, you can use keywords to instantly jump to any site you've bookmarked. To do it, after you bookmark a site, right-click on the bookmark, select Properties, type in a short keyword (or even just a letter or two) in the keyword field and click OK. Now, to visit the site, type in the keyword in Firefox's address bar, and you'll jump straight to the site.

5. Hack the Firefox interface with userChrome.css

If you want to do some serious hacking to the Firefox interface, you're going to have to get your hands dirty and edit a file called userChrome.css. This file is a cascading style sheet and contains instructions on how the Firefox interface should display.

Before you can edit the file, though, you need to create it, because by default, Firefox doesn't create one for you. You'll need to take an existing .css file, and rename it to userChrome.css. In Windows Vista, go to C:\Users\Your Name\AppData\Roaming\Mozilla\Firefox\Profiles\xxxxxxxx.default\chrome, where Your Name is your account name, and the .xxxxxxxx is a random selection of eight characters.

In Windows XP, go to C:\Documents and Settings\Your Name\Application Data\Mozilla\Firefox\Profiles\default.xxxxxxxx\chrome, where Your Name is your XP account name, and the .xxxxxxxx will be a random selection of characters. In the folder, you'll find a file called userChrome-example.css. Rename that userChrome.css, and you'll be ready to start editing.

Note: The Application Data folder may not be visible to you unless you have checked the option to display hidden files and folders. To do this from a folder window, click on Tools and select Folder Options, then click on View, then select the radio button for Show hidden files and folders.

The userChrome-example.css file is a plain-text file, so you'll edit it with a text editor such as Notepad or an alternative. As you'll see in the following tricks, you'll add code and text to the userChrome.css file in order to change the Firefox interface.

It's a good idea, when inserting the code, to include a reminder so that later you remember what that code does. The file userChrome.css will ignore your reminder and won't try to interpret it as code. To create a reminder, surround your comments with /* to begin and */ to end, like this:

/* This is a comment */

The userChrome.css file will ignore everything inside the /* and */.

With that background under your belt, it's time to teach Firefox some new tricks.

6. Put your own graphic on the Firefox tool bar

If you don't like the plain background of Firefox's tool bar, don't worry -- you can put your own graphic there. Type the following into the userChrome.css file and put the graphic that you want to use, background.gif, in the same directory as userChrome.css. The graphic can be any name and any type of image file supported by Firefox.

Here's the code to use:

 
/* Change the toolbar graphic */
menubar, toolbox, toolbar, .tabbrowser-tabs {
background-image: url("background.gif") !important;
background-color: none !important;
}

Page Break

The graphic you use will automatically be scaled to fit the tool bar. For example, if it's small, it will be tiled.

7. Hack the stop, back and forward buttons

Are you a minimalist? Does it annoy you that there's a big fat Stop button on the Firefox tool bar, even when there's nothing to stop? And how about the Forward and Back buttons -- if there's no place to go forward or back, would you like them simply to disappear?

You're in luck, because it's simple to do. Add these lines below to userChrome.css. Note that even after this trick, the buttons will appear when there's a use for them. For example, when a page is loading, the Stop button will appear, so that you can stop loading the page; it just won't appear when a page isn't loading. And the Forward and Back buttons will appear when there's something to go forward or back to:


/* Remove the Stop button when content isn't loading*/
#stop-button[disabled="true"] { display: none; }

/* Remove the Back button when there's nothing to go back to */ #back-button[disabled="true"] { display: none; }

/* Remove the Forward button when there's nothing to go forward to */ #forward-button[disabled="true"] { display: none; }

8. Move the sidebar to the right

Firefox has a sidebar for viewing your history or bookmarks. It normally displays on the left-hand side when you choose View-->Sidebar. If you prefer, though, you can have the sidebar instead appear on the right, by typing this code into the userChrome.css file:


/* Place the sidebar on the right edge of the window */
hbox#browser { direction: rtl; }
hbox#browser > vbox { direction: ltr; }

9. Change the search bar width

Don't like the width of the search bar on the upper-right hand corner of Firefox? No problem -- it's easy to change. All you need to do is specify the width you want, in pixels. Use this code in userChrome.css to tell the search bar to be 600 pixels wide, but you can, of course, use whatever size you want:


/* Make the Search box wider
(in this case 600 pixels wide) */
#search-container, #searchbar {
max-width: 600px !important;
width: 600px !important; }

Page Break

10. Remove menu items

Are there menu items -- for example, Help -- that you never use? If so, you can easily make them disappear. To remove the Help menu, add this to

userChrome.css:


/* Remove the Help menu */
menu[label="Help"] {
display: none !important; }

You can remove any of the other menus as well. Use the same syntax as above and substitute its name (File, Edit, View, History, Bookmarks or Tools). So, for example, to remove both the Help and Tools menu, you'd add these lines to userChrome.css:


/* Remove the Help and Tools menus */
menu[label="Tools"], menu[label="Help"] {
display: none !important; }

11. Protect your privacy when surfing with Firefox

When you surf the Internet, your life is an open book. Web sites can gather an astonishing amount of information about you, including tracking your online travels, knowing what operating system and browser you're running, finding out your machine name, uncovering the last sites you've visited, and examining your IP address and using that to learn basic information about you such as your geographic location and more.

There's a simple way to keep that information away from prying Web sites -- use the FoxTor add-in. It uses Tor software to, in essence, bounce all of your communications around a giant network of Tor servers called "onion routers" until it's impossible for sites or people to be able to track your activities.

First, you need to install the free software Tor. Download it, and install Tor and the included Privoxy, a proxy program. It's all self-explanatory.

Once you do that, install the FoxTor add-in. After you install it, you'll see your Tor status on the lower-left corner of the screen, either Unmasked (which means you're not protected), or Masked (which means you are protected). To toggle between modes, click the corner.

12. Limit Firefox's use of RAM

Does Firefox use up too much of your RAM? Teach it to behave by limiting the amount of RAM it uses. To do it:

  1. Type about:config into your address bar and hit Enter.
  2. In the Filter text box, at the top of the page, type browser.cache.
  3. Double-click the "browser.cache.disk.capacity" entry.
  4. The default is 50000. If you don't have a lot of memory on your system, for example, between 512MB and 1GB, change the number to 15000 and click OK.

Page Break

13. Use Firefox keyboard shortcuts

Quit mousing around when you use Firefox -- get work done faster with the following keyboard shortcuts.

General shortcuts
Keyboard shortcut: Ctrl-D What it does: Add bookmarks
Keyboard shortcut: Ctrl-B What it does: Display bookmarks in the sidebar
Keyboard shortcut: Ctrl-J What it does: Display downloads
Keyboard shortcut: F11 What it does: Full screen view
Keyboard shortcut: Ctrl-H What it does: Display history
Keyboard shortcut: Ctrl-P What it does: Print
Keyboard shortcut: F5 What it does: Refresh page

Navigation shortcuts
Keyboard shortcut: Alt-Left Arrow What it does: Back
Keyboard shortcut: Alt-Right Arrow What it does: Forward
Keyboard shortcut: Ctrl-O What it does: File Open
Keyboard shortcut: F6 What it does: Next Frame
Keyboard shortcut: Shift-F6 What it does: Previous Frame
Keyboard shortcut: Alt-Home What it does: Go to Home Page
Keyboard shortcut: Ctrl-L What it does: Go to the Address Bar
Keyboard shortcut: Ctrl-K What it does: Go to the Search Box
Keyboard shortcut: Esc What it does: Stop
Keyboard shortcut: Ctrl-T What it does: Open a tab
Keyboard shortcut: Ctrl-W What it does: Close a tab
Keyboard shortcut: Ctrl-Tab What it does: Go to the next tab
Keyboard shortcut: Ctrl-Shift-Tab What it does: Go to the previous tab
Keyboard shortcut: Ctrl- (1-9) What it does: Select a specific tab
Keyboard shortcut: Alt-F4 What it does: Close a window
Keyboard shortcut: Ctrl-N What it does: Open a new window

Text shortcuts
Keyboard shortcut: Ctrl-C What it does: Copy
Keyboard shortcut: Ctrl plus - What it does: Decrease text size
Keyboard shortcut: Ctrl plus + What it does: Increase text size
Keyboard shortcut: Ctrl-0 What it does: Return to text size default

14. Hack Firefox printing

Firefox offers quite a bit of control over how you print your Web pages, including printing headers and footers, what to put in those headers and footers, page margins and a good deal more. To customize printing, choose File-->Page Setup. Click the Margins & Header/Footer tab, and you'll see a screen like that shown nearby.

Most of this is pretty self-explanatory. The top part of the screen lets you set the margins along the top, bottom and sides of the page. The bottom part lets you choose whether to print headers and footers, and choose to print text such as the URL of the page, the date and the time, and so on. Just make your selection from the drop-down list.

You're not stuck with just what's on the drop-down list, either. You can customize your printing as well. Select Custom from any of the drop-down lists, and a Custom text box appears. Whatever text you type in that box will appear when you print. The power of this becomes apparent when you combine this with special codes that use variables. Following are the list of variables you can put into the text box and what they'll do:

Page Break

Printing shortcuts
Variable: &PT What it prints: Page number and total number of pages (for example: "1 of 4")
Variable: &P What it prints: Page number
Variable: &D What it prints: Date
Variable: &U What it prints: URL
Variable: &T What it prints: Page title

You can combine these codes with text. So, for example, if you visited a Web page on Dec. 15, 2008, the Web page was five printed pages long and you typed in this code:

Preston printed &P on &D

this is what you'd see on page 3 of the printout:

Preston printed 3 of 5 on 12/15/2008

15. Load a bookmarked Web page in the sidebar

If you've bookmarked a Web page, when you visit it next, you can have Firefox load it in the Sidebar, rather than in your main browser area. To do that, right-click the bookmark that you want to load in the Sidebar, select Properties, check the box marked "Load this bookmark in the sidebar," then click OK.

When you then select the bookmark to go to the site, the site will load in the Sidebar. You may need to expand the width of the sidebar by dragging the right edge, to get the site to display properly. The nearby figure shows one site loaded in the Sidebar and another in the main browsing area.