Practically every Web surfer has bookmarks, of course, and power surfers usually have hundreds stuffed into folders within folders. In addition to being handy pointers to useful resources, bookmarks in Mozilla can be used to make the address bar itself a power tool. Searches, lookups, package tracking, and even word definitions can all be retrieved from user-customized bookmarks.
The key to this ability, if you'll pardon the pun, is the ability to add a keyword to any Mozilla bookmark. Under ordinary circumstances, this might be used to reduce typing of a common URL:
http://www.cnn.com/ could be given the keyword
cnn. Once that's done, all it takes to go to the CNN home page would be to type <tt>cnn</tt> into the address bar. Mozilla will automatically expand the keyword to the corresponding bookmarked URL, and load up the site.
That's pretty interesting on its own, but Mozilla takes it a step further by allowing the user to define an "entry point" for added information. For example, a keyworded bookmark could be set up so that a user could type <tt>google spam and eggs</tt> and thereby trigger a Google search for the words "spam and eggs."
Because these tools require bookmarks with specific keywords in order to work, they will be referred to hereafter as keymarks, as distinct from regular bookmarks.
We're going to pick a relatively easy example to illustrate this process: a keymark that will let the user jump straight to a specific Bugzilla entry by entering its number. The quickest way to start is to simply look up any random bug in the Bugzilla system-- the actual number doesn't matter. See Figure 1 for an example.
To file this bookmark open the "Bookmarks" menu in the browser and select "Add Bookmark," or by of use the keyboard equivalent (e.g., <tt>cmd-D</tt> on Macintosh). This will add a bookmark of the current page to the list of bookmarks. You can also file the bookmark into a folder by using the "File Bookmark..." menu option.
To open the Bookmark manager go to "bookmarks" menu and select the "Manage Bookmarks" option. This will open up the Bookmark manager. In Figure 2, we can see the bookmark has been filed into a folder called "Widgets." You can create a folder with another name, or not put your keymarks into a folder at all.
To alter the properties of the bookmark, highlight the bookmark and select the "Properties..." button at the top of the Bookmark manager. This will open up a dialog box that will let you edit the properties of the bookmark.
The original title of the bookmark won't apply. You can name the bookmark whatever you want, but it's often handy to make the title very similar to the keyword you plan to use. That way, if you ever forget the keyword you've assigned to a bookmark, you only have to glance at the bookmark's title to remember the keyword. However, the two should not be a case-sensitive match-- that is, if your keyword is
av, then your title should be "Av" or "AV" or anything besides "av." (See Bugzilla entry 119201 for details.) Since this bookmark is intended to look up Bugzilla entries, we'll call it "BZ," as shown in Figure 3.
Here's where the power starts to show up. Switch to the "Location:" field and go all the way to the end. Replace the bug's number (
82839) with the string
%s. You should end up with the result shown in Figure 4, without the red highlighting.
%s is a little flag that means "insert user input here." It doesn't have to go at the end of the location field-- it can be anywhere inside the field. You just need to fill in whatever piece of a URL it is you want to be able to "fill in" when you use the keymark.
All we need now is a keyword, and our keymark will be ready to go. Fill in the value
bz, as shown in Figure 5.
With that done, all you have to do in the future is type <tt>bz</tt> followed by a space and the bug's number into Mozilla's address bar, and the browser will jump right to the bug with that number. This is illustrated in Figure 6.
That's all it takes!
To set up a keymark that will search Google directly form the address bar, go to Google and run a search for any word. Once you get a result page, bookmark that page. You'll need to replace the word for which you searched. One such example, with the relevant term highlighted, is shown in Figure 7.
Once this result page has been bookmarked, we need only adjust the boookmark's properties. In this case, we'll give it a keyword and title of
%s, as shown (with extra highlighting) in Figure 8.
Now we can run Google searches straight from the address bar. These searches can be as complex as Google will tolerate, since the entered data will be converted to URL-encoded text before it's sent to the Google servers. Thus we could type any of the following into the address bar and get back useful results:
- <tt>google geitost</tt>
- <tt>google Mozilla Keyword Bookmark</tt>
- <tt>google bookmark site:developer.netscape.com</tt>
- <tt>google netscape XML support -site:netscape.com</tt>
In the course of writing this article, a number of potentially useful bookmarks were considered as possible examples. Instead of just throwing them away, we're providing them for you in the following table. Even better, you can file them for future use by right-clicking (or holding down the control key and clicking on the link) and filing the bookmarks using the "File Bookmark..." option in the contextual menu that pops up. Once that's been done, making the keymark work is a simple matter of going into the Bookmark manager and adding a keyword!
|Find Bugzilla entry||bug, bugzilla, bz|
|Search Devmo||devmo, de|
|Google Search||google, gg|
|Dictionary Search||dictionary, dict, define, word|
|Thesaurus Search||thesaurus, like|
Of course, these are just a beginning. Any Web site that you commonly search is a candidate for its own keymark.
Thanks to Asa Dotzler and his article How Cool are Custom Keywords?, which provided the inspiration to write this article.
Original Document Information
- Author(s): Eric A. Meyer, Netscape Communications
- Last Updated Date: Published 15 Mar 2002
- Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.
- Note: This reprinted article was originally part of the DevEdge site.