Bookmark Keywords

  • Revision slug: Bookmark_Keywords
  • Revision title: Bookmark Keywords
  • Revision id: 185889
  • Created:
  • Creator: Iamwriter
  • Is current revision? No
  • Comment /* Laying the Groundwork */

Revision Content

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.

Laying the Groundwork

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.

Figure 1

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.

Figure 2

Changing the Properties

Now we need 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 from now on, so let's change it. 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.

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.

Figure 4

The %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.

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.

Figure 6

That's all it takes!

Setting up a Google Keymark

Let's quickly set up a keymark that will let us search Google directly form the address bar. First, go to Google and run a search for any word that strikes your fancy. 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.

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 google and replace the term "geitost" with the %s, as shown (with extra highlighting) in Figure 8.

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>

A Few Examples

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!

Bookmark Suggested Keywords
Find Bugzilla entry bug, bugzilla, bz
Search Devmo devmo, de
Google Search google, gg
Dictionary Search dictionary, dict, define, word
Thesaurus Search thesaurus, like
FedEx Tracking fedex
UPS Tracking ups

Of course, these are just a beginning. Any Web site that you commonly search is a candidate for its own keymark.

Acknowledgements

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.

Revision Source

<p>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.
</p><p>The key to this ability, if you'll pardon the pun, is the ability to add a <i>keyword</i> to any Mozilla bookmark. Under ordinary circumstances, this might be used to reduce typing of a common URL: <code><span class="plain">http://www.cnn.com/</span></code> could be given the keyword <code>cnn</code>. 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.
</p><p>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."
</p><p>Because these tools require bookmarks with specific keywords in order to work, they will be referred to hereafter as <i>keymarks</i>, as distinct from regular bookmarks.
</p>
<h3 name="Laying_the_Groundwork"> Laying the Groundwork </h3>
<p>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.
</p><p><img align="none" alt="Figure 1" src="File:en/Media_Gallery/Bookmark-keywords-figure1.gif">
</p><p>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.
</p><p>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.
</p><p><img align="none" alt="Figure 2" src="File:en/Media_Gallery/Bookmark-keywords-figure2.gif">
</p>
<h3 name="Changing_the_Properties"> Changing the Properties </h3>
<p>Now we need 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.
</p><p>The original title of the bookmark won't apply from now on, so let's change it. 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 <code>av</code>, then your title should be "Av" or "AV" or anything besides "av." (See <a class="external" href="http://bugzilla.mozilla.org/show_bug.cgi?id=119201">Bugzilla entry 119201</a> for details.) Since this bookmark is intended to look up Bugzilla entries, we'll call it "BZ," as shown in Figure 3.
</p><p><img align="none" alt="Figure 3" src="File:en/Media_Gallery/Bookmark-keywords-figure3.gif">
</p><p>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 (<code>82839</code>) with the string <code>%s</code>. You should end up with the result shown in Figure 4, without the red highlighting.
</p><p><img align="none" alt="Figure 4" src="File:en/Media_Gallery/Bookmark-keywords-figure4.gif">
</p><p>The <code>%s</code> 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.
</p><p>All we need now is a keyword, and our keymark will be ready to go. Fill in the value <code>bz</code>, as shown in Figure 5.
</p><p><img align="none" alt="Figure 5" src="File:en/Media_Gallery/Bookmark-keywords-figure5.gif">
</p><p>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.
</p><p><img align="none" alt="Figure 6" src="File:en/Media_Gallery/Bookmark-keywords-figure6.gif">
</p><p>That's all it takes!
</p>
<h3 name="Setting_up_a_Google_Keymark"> Setting up a Google Keymark </h3>
<p>Let's quickly set up a keymark that will let us search Google directly form the address bar. First, go to Google and run a search for any word that strikes your fancy. 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.
</p><p><img align="none" alt="Figure 7" src="File:en/Media_Gallery/Bookmark-keywords-figure7.gif">
</p><p>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 <code>google</code> and replace the term "geitost" with the <code>%s</code>, as shown (with extra highlighting) in Figure 8.
</p><p><img align="none" alt="Figure 8" src="File:en/Media_Gallery/Bookmark-keywords-figure8.gif">
</p><p>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:
</p>
<ul><li> <tt>google geitost</tt>
</li><li> <tt>google Mozilla Keyword Bookmark</tt>
</li><li> <tt>google bookmark site:developer.netscape.com</tt>
</li><li> <tt>google netscape XML support -site:netscape.com</tt>
</li></ul>
<h3 name="A_Few_Examples"> A Few Examples </h3>
<p>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!
</p>
<table class="standard-table">


<tbody><tr>
<td class="header">Bookmark
</td><td class="header">Suggested Keywords
</td></tr>

<tr>
<td><a class="external" href="http://bugzilla.mozilla.org/show_bug.cgi?id=%s">Find Bugzilla entry</a>
</td><td>bug, bugzilla, bz
</td></tr>

<tr>
<td><a class="external" href="http://developer.mozilla.org/docs/Special:Search?search=%s&amp;go=Consulter">Search Devmo</a>
</td><td>devmo, de
</td></tr>

<tr>
<td><a class="external" href="http://www.google.com/search?q=%s">Google Search</a>
</td><td>google, gg
</td></tr>

<tr>
<td><a class="external" href="http://www.dictionary.com/search?q=%s">Dictionary Search</a>
</td><td>dictionary, dict, define, word
</td></tr>

<tr>
<td><a class="external" href="http://www.thesaurus.com/cgi-bin/search?config=roget&amp;words=%s">Thesaurus Search</a>
</td><td>thesaurus, like
</td></tr>

<tr>
<td><a class="external" href="http://www.fedex.com/cgi-bin/tracking?tracknumbers=%s&amp;action=track">FedEx Tracking</a>
</td><td>fedex
</td></tr>

<tr>
<td><a class="external" href="http://wwwapps.ups.com/etracking/tracking.cgi?tracknums_displayed=1&amp;TypeOfInquiryNumber=T&amp;HTMLVersion=4.0&amp;InquiryNumber1=%s">UPS Tracking</a>
</td><td>ups
</td></tr>
</tbody></table>
<p>Of course, these are just a beginning. Any Web site that you commonly search is a candidate for its own keymark.
</p>
<h3 name="Acknowledgements"> Acknowledgements </h3>
<p>Thanks to Asa Dotzler and his article <a class="external" href="http://www.mozilla.org/docs/end-user/keywords.html">How Cool are Custom Keywords?</a>, which provided the inspiration to write this article.
</p>
<div class="originaldocinfo">
<h3 name="Original_Document_Information"> Original Document Information </h3>
<ul><li> Author(s): Eric A. Meyer, Netscape Communications
</li><li> Last Updated Date: Published 15 Mar 2002
</li><li> Copyright Information: Copyright © 2001-2003 Netscape. All rights reserved.
</li><li> Note: This reprinted article was originally part of the DevEdge site.
</li></ul>
</div>
Revert to this revision