O'Reilly logo

Firefox Hacks by Nigel McFarlane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #33. Use Fancy Bookmarks

Bookmarks can do more than record web pages. See how they've grown.

Hidden inside Firefox's bookmark system are a number of advanced features. This hack explains how to use them.

The Firefox bookmarks user interface is different from that of the Mozilla Application Suite or Netscape. In particular, the Check for Updates and Notify functionality is missing in Firefox 1.0. That feature causes the browser to optionally poll bookmarked web pages to see whether they have changed recently. Firefox supports the same bookmark format as other Mozilla browsers, but Version 1.0 just doesn't do any polling. Check the release notes for later, minor versions to see if that feature has been added back in recently. In these modern times, RSS is probably the new way forward for polled web content. See "Live Bookmarks" later in this hack for more on RSS.

In addition to the features described in this hack, there are several extensions that extend the bookmark system. Feed readers [Hack #37] are just one example. Have a look at the Bookmarks category at http://update.mozilla.org.

Use Tab Group Bookmarks

If you have multiple tabs open at once, you can bookmark them all in one go. Choose BookmarksBookmark this Page and tick the "Bookmark all tabs in a folder" checkbox, as shown in Figure 4-1.

Adding all open tabs to a bookmark

Figure 4-1. Adding all open tabs to a bookmark

The folder will be named with the title of the leftmost tab. To reopen that set of bookmarks as tabs, drill down through the Bookmarks menu and submenus to the folder you want to see and then choose the bottom menu item (the one labeled Open in Tabs).

It's also possible to start up Firefox so that multiple tabs are displayed. This functionality is not available in bookmarks. Use a URL in this format to make it happen:

http://www.example.com/page1.html|http://www.example.com/page2.html

The vertical bar character (|) separates the URLs for each tab. This syntax can be used on the command line when starting Firefox, or it can be specified as the default home page in the ToolsOptionsGeneral dialog box. Because the pipe character has other historic uses, this syntax is not locked in stone yet, but it is available and working in Firefox 1.0.

Use Sidebar Bookmarks

A bookmark can be opened in the Firefox sidebar rather than in the main page. To do so, first create the bookmark. Next, open the Bookmark Manager using BookmarksManage Bookmarks.... Drill down to the bookmark, right-click on it, and choose Properties. In the dialog box, tick the "Load this bookmark in the sidebar" checkbox, as shown in Figure 4-2.

Making a bookmark display in the sidebar

Figure 4-2. Making a bookmark display in the sidebar

Once the bookmark is saved, recalling it opens the sidebar and loads the page into it.

Use Keyword Bookmarks

A keyword bookmark matches more than one web page. Usually, the page you want is parameterized, which means that it represents an HTTP GET request and includes special query values. Keyword bookmarks allow one parameter of the bookmark's URL to be left unspecified. When that is done, the bookmark can't (usually) be loaded by clicking on any bookmark icon. Instead, you use the bookmark by typing a keyword and parameter into the Location bar.

Here are two examples. The first URL identifies a Mozilla Bugzilla bug report by bug number. The second identifies an Amazon.com book by its Amazon ASIN, which for a book is typically its ISBN number:

https://bugzilla.mozilla.org/show_bug.cgi?id=273050
http://www.amazon.com/exec/obidos/ASIN/0131423436/

After the special bookmarks are created, you can recall any bug or any book just by typing short keywords into the Location bar:

bug 273050
book 0131423436

In short versions, the second term can be varied without changing the bookmark, so all of these are supported as well:

bug 12345
bug 13
book 0131313131

To create such a keyword bookmark, construct a bookmark for each original URL and open the Properties dialog box for each one. Then, make the URL for the bookmark more generic by changing the Location: field as follows:

https://bugzilla.mozilla.org/show_bug.cgi?id=%s

http://www.amazon.com/exec/obidos/ASIN/%s
/

The %s characters (stolen from the syntax of printf() format masks) will be replaced with the single parameter supplied. %s can appear only once. In the Keyword: field, type in the new keyword for the bookmark, in this case one of these two:

bug
book

Save these changes. Figure 4-3 shows the final setup for the Amazon.com example.

Keyword bookmark for Amazon.com books

Figure 4-3. Keyword bookmark for Amazon.com books

The SmartSearch extension adds some user-interface niceties to keyword bookmark functionality. Find it at http://update.mozilla.org.

Live Bookmarks

Firefox's major bookmark innovation is to integrate RSS feeds into the bookmark system. In this case, one bookmark stands for a whole RSS feed and appears as a bookmark folder. When the folder is opened (usually after being placed on the Bookmarks Toolbar), the feed is downloaded and a bookmark is created in the folder for each feed item found. The simplest way to create a Live Bookmark is to click on the RSS feed icon [Hack #4] that appears on the status bar when a web page advertises that a feed is available.

To create a live bookmark manually, just open the Bookmark Manager window (BookmarksManage Bookmarks), click on the folder that will hold the live bookmark, and choose FileNew Live Bookmark. Fill in the RSS XML- or RDF-based URL, and you're finished.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required