You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



How Cool are Custom Keywords?

by Asa Dotzler, edited by Daniel Wang

Mozilla Custom Keywords ROCK! Not just for making shorthand for bookmarks but also for searches and queries. Simple keywords allow you to type a short string in the Location Bar and load its corresponding Bookmark URL.

An example is my bookmark for http://www.mozilla.org to which I've added the keyword m.o. So, with that set, I can type m.o in the Location Bar and it loads http://www.mozilla.org. Using keywords combined with autocomplete in Mozilla and I seldom type more than about three or four characters for all of the sites I regularly visit.

To set a keyword you must first create a bookmark for the URL. Then you add the keyword to the bookmark. Open the Bookmark Manager (Ctrl+B), choose your bookmark, and then open the Bookmark Properties window (Ctrl+I, or from the context menu). In the window simply add a short string to the Keyword field. Now close that dialog and you can type the keyword in the Location Bar, hit enter, and Mozilla will load that URL.

But that's just the beginning. Custom keywords can be used to create shortcuts for your favorite search engines too (the 'this ROCKS!' part). Here's how it works.

I'll use Bugzilla Bug Report lookup as an example.

The keyword "bug" followed by a space and the bug number will load the URL "https://bugzilla.mozilla.org/show_bug.cgi?id=" + the bug number "12345".

Some other really cool examples:

  • http://www.google.com/search?q=%s (I gave it the keyword "?")
  • http://www.google.com/search?q=%s&btnI=I'm+Feeling+Lucky (I gave it the keyword "g")
  • http://search.dmoz.org/cgi-bin/search?search=%s (I gave it the keyword "dmoz")
  • http://www.dictionary.com/cgi-bin/dict.pl?term=%s (I gave it the keyword "dict")
  • http://lxr.mozilla.org/seamonkey/find?string=%s (I gave it the keyword "lxrfile")
  • http://lxr.mozilla.org/seamonkey/search?string=%s (I gave it the keyword "lxrtext")

There are probably other great uses for this, just try a query at your favorite search engine and look at the URL it generates. If you can replace your search string in that URL with "%s" you can probably make this work. Throw in a little javascript and it's off to the races :)