Firefox Keywords With String Substitution

I have been using Firefox keywords with string substitution since FF version 2 and am amazed at the small number of my friends and coworkers know about and use them.  What the heck am I talking about?  Keep reading…

Everyone knows how to save a URL as a favorite – every browser does it.  But not every browser offers the ability to assign a “keyword” to that URL.  This is a user-defined symbolic name to represent whatever URL you’re saving in the bookmark.  It’s like shrinkster, tinyurl, etc. for your local browser.  Once defined, type the couple characters into the Firefox address bar and you’ll be whisked off to the full URL.

g = http://www.google.com
traf = http://www.dot.ca.gov/dist11/d11tmc/sdmap/showmap.html
azure = https://lx.azure.microsoft.com/Cloud/Provisioning/Default.aspx
… etc …

“No bid deal” you’re saying?  It definitely saves keystrokes, but here’s where the magic happens.  String substitution allows you to build up the URL with a placeholder, where anything you type in the address bar after the keyword gets stuffed into the URL.  This is probably most often used for search forms, where you save the time of hitting the search form, then typing in the search terms, then hit GO.

gm = http://maps.google.com/maps?q=%s
“gm carlsbad” = %s replaced with “carlsbad” to get a google map look up on carlsbad

wu = http://www.weatherunderground.com/cgi-bin/findweather/getForecast?query=%s
“wu carlsbad” = %s replaced with carlsbad to get weather lookup on carlsbad

wp = http://en.wikipedia.org/wiki/Special:Search?search=%s
“wp superbowl” = lookup “superbowl” on wikipedia

del = http://del.icio.us/volleynerd/%s
“del azure” = finds me my delicious bookmarks for a given tag

My favorite by far for everyday development:  I built the URL for a google “site-specific” query against microsoft.com to find a .NET class name, method, property, etc.  Almost guaranteed to find me the MSDN SDK topic I’m looking for in the top 3 results.

gms = http://www.google.com/search?biw=1263&hl=en&q=site%3Amicrosoft.com+%s

“gms window class”  from the address bar immediately finds me the MSDN docs on the .NET Window class

Now that you’re (hopefully) sold – it’s super easy to create these shortcuts with keywords and string substitution. 

Firefox-Bookmark-Keywords

  • Go to the site or perform a search like you would “in the old days”
  • Create a bookmark for the results like you would for any other page
  • Edit the bookmark and tweak the URL – replace the search term you entered with a %s
  • In Firefox 3, hit the “More” button to see the keyword field
  • Enter your desired keyword

These are just regular old “favorites” in Firefox’s mind, so they’ll sync to multiple machines if you’re using something like Foxmarks.

Enjoy the shortcuts!

Comments:  if you’re using Firefox shortcuts with keywords and string substitution – leave me a comment with some of your favorites.

Leave a Reply

Your email address will not be published. Required fields are marked *