O'Reilly Book Excerpts: Firefox Hacks
Hacking Firefox: Add Stuff to Your Toolbars
Editor's note: We've all heard about Firefox--the David to Microsoft's Goliath in the browser wars--but if you've been using Firefox for a while now, chances are you're itching to see what it can really do. O'Reilly's Firefox Hacks offers 100 tips and techniques that let you get the most out of Firefox. To give you an idea of what you'll find in the book, we offer this excerpt that'll show you how to really trick out your toolbars.
Install extra stuff on the Firefox toolbars and use it to browse in new ways.
This hack shows how to upgrade Firefox toolbars and use the new features added. There are many extensions that can be usefully put on toolbars, but currently few extensions do this automatically. This hack focuses on two example extensions that benefit from toolbar icons: InfoLister and Gmail Notifier.
Adding toolbar icons, whether they're standard Firefox ones or special extension ones, is simplicity itself. Make sure the toolbar you're interested in modifying is already displayed; then, choose View -> Toolbars -> Customize to see the list of available icons. Merely drag an icon to the desired spot on the desired toolbar and release the mouse button. Some extensions do this set up for you when they install; others don't. If nothing seemed to happen after you installed an extension and restarted, check the set of available icons in case more have been added.
Let's generate an HTML list of all the stuff you currently have installed in your implementation of Firefox. All you need to achieve this is InfoLister, a Firefox/Thunderbird extension (http://mozilla.klimontovich.ru/infolister/) by Nickolay Ponomarev.
Once you have installed the extension and placed its icon in the Location toolbar, it looks something like Figure 4-11. You can see lots of extra toolbar icons in this screenshot.
Figure 4-11. Firefox toolbar with InfoLister icon highlighted
Displaying the InfoLister Window
Clicking the InfoLister toolbar icon brings up the InfoLister window, shown in Figure 4-12. In the main area of the window, an HTML page lists all your extensions, themes, and plug-ins. All the extension and themes names in the list are linked to their respective home pages.
Figure 4-12. The InfoLister window
Customizing the Page
If you want to tweak the info page a bit, just press the Options...
button. A new InfoLister Options window will pop up. In the Customize
section of this window, you can choose whether to display the page in
HTML or plain text. Then, if you choose HTML formatting, you can
provide content details of the
In the next part of the form, also available for plain text, you can
put some stuff at the head of the page. Then you can define the
appearance of extensions and themes on the page, using several
Replaced by the actual extension's homepage URL
Holds the extension's real name
Holds the extension's version number
You can also compose footnotes at the base of the page. There are three checkboxes that, if selected, generate their respective information just under the page's headline:
- Last Update Time
Specifies whether to write a timestamp when the InfoLister report is saved to disk
- User Agent
Gives you an exact description of your implementation of Firefox (i.e., agent name, platform, locale, build, and browser name), including its version
- Plugins List
Allows you to switch the plug-ins list on or off
Some extensions might be disabled. To list them separately on the page, just choose the last option: "Make a separate list for disabled extensions."
Saving the Page
There are two ways to save the generated page: in a local file or on a remote server. To save it locally, just fill in the file location in the "Autosave to file" section. Once you provide the file location, you can write to it immediately by clicking the "Write now" button, or have it rewritten each time you restart the browser. To upload the page to a remote server, you need to provide some information to set up a connection and log to the server. Press the "FTP settings..." button to display a form in which you can include these details, as shown in Figure 4-13.
Figure 4-13. InfoLister FTP Settings dialog
Try Gmail Notifier
Another example of a useful extension that provides a toolbar icon is Gmail Notifier by Doron Rosenberg. This extension checks your Gmail (Google Mail) inbox and alerts you when new mail arrives.
Installing Gmail Notifier
To start using Gmail Notifier, you first need to install it. It's available from the Mozilla Update web site (http://update.mozilla.org). As with InfoLister, when the install is complete, place Gmail Notifier's icon on your Firefox toolbar using View -> Toolbars -> Customize. Figure 4-14 shows the installed extension's toolbar icon, status bar icon, and its initial login window.
Figure 4-14. Gmail Notifier toolbar icon and login screen
Getting to Your Inbox
To get access to your inbox, you need to set up Gmail Notifier with your username and password. If you hate remembering passwords, you can select the "Remember password" option on the login form. Firefox will then skip this prompt the next time it gets online, and you'll log on automatically. Once you are logged on, simply click the toolbar or status bar icon and you'll display your Gmail inbox. You can open this page in the current tab, a new tab, or even a new window, depending on what you have configured in Notifier's Preferences pane.
Gmail Notifier Preferences
You can use Gmail Notifier's Preferences pane to specify where your inbox page will open, how often Gmail Notifier will check for new email, and other options. To change your settings, just context-click (Right-click or Command-click) on the Gmail Notifier icon on the status bar and choose Preferences. Figure 4-15 shows the context-menu options.
Figure 4-15. Gmail Notifier context menu
In the User Interface section of the Preferences pane, you can choose to also show the icon on the status bar, select where to open your inbox page (current tab, new tab, or new window) when you click the icon, and choose to be alerted when new mail arrives. The last setting is currently available for Windows only. Figure 4-16 shows that standard alert.
Figure 4-16. New Gmail alert
In the Connection section, you can define how many minutes the Gmail Notifier should wait between periodic checks for new email and whether you want to log in automatically. Enabling this last feature is much appreciated when you don't share the computer with others.
When Gmail Notifier spots a number of new email messages in your inbox, the Gmail icon is marked with that number, but unfortunately you don't have a clue what kind of emails they are, unless you open the inbox page. This might be cumbersome in some circumstances. To gain a list of arrived emails subjects, you will need to create a Live Bookmark [Hack 33] with the following URL:
Note that this stores your Gmail username and password in cleartext in the bookmarks file. A Live Bookmark with this URL will check the content of your Gmail inbox with the frequency set in Firefox for Live Bookmarks. When you open the Live Bookmark folder, any new emails appear just as if the email were part of a news feed (which it effectively is), as shown in Figure 4-17.
Figure 4-17. Unread Gmail messages displayed as an RSS feed
Be aware that sometimes the number of new email messages shown by this Live Bookmark might be out of step with the number of new email messages shown in the Gmail Notifier icon. In such a case, just choose Refresh Live Bookmark from the context menu of the Live Bookmark.
Finally, this Live Bookmark works only when there is new email in your inbox. If there isn't, Firefox fails to download the Live Bookmark feed. Hopefully, this functionality will be nicely embedded into the Gmail Notifier icon by the time you read this. Gmail Notifier is an extension with a bright future.
View catalog information for Firefox Hacks
Return to Windows DevCenter.