Tuesday, November 17, 2015

Personal searches from the address bar in Firefox and Chrome

Most modern browsers allow you to invoke the default search engine directly from the Address bar (aka the awesome bar or the omnibox), but did you know that you can easily access other search engines from the very same box? Assigning a keyword for alternate searches will allow you to invoke that search directly from the Address bar by typing the keyword, followed by a space and then the search query.

When paired with a shortcut to jump to the Address bar (e.g. Control + L), these keyword searches make for great workflow in the browser.

Adding new keyword search is easy: simply right-click on any search box and choose Add As Search Engine (Chrome) or Add a Keyword for this Search... (Firefox). Use the Keyword field to give the search a short handle that you can quickly type into the address bar to prefix your search.

How It Works

In both Chrome and Firefox, the URL field is the secret to making this work. The browser will automatically replace the "%s" string with the contents of your search query, meaning you can define a custom search for just about any URL.

To edit a keyword search, or to create your own from scratch, the process varies a little between the two broswers:

  • In Chrome, right-click the address bar and select Edit Search Engines...
  • In Firefox, the keyword searches are managed as bookmarks and can be created/edited from the manage bookmarks dialog.

My Searches

Full disclosure: the real reason I wrote this post is to document my keyword searches for future me. If you are a web developer or happen to use the same services as me, then maybe you can benefit from them too:

Site Keyword URL
Wikipedia wp http://en.wikipedia.org/w/index.php?title=Special:Search&search=%s
Delicious (links) d https://delicious.com/lmsurprenant/%s
Stack Overflow so http://stackoverflow.com/search?q=%s
Mozilla Developer Network mdn http://mdn.io/%s
Node Packaged Modules npm http://node-modules.com/search?q=%s
Evernote ever https://www.evernote.com/Home.action?offer=www_menu#n=056dfe4a-e94a-4d9f-8e49-cac92a0d21bb&ses=1&sh=5&sds=5&x=polygraphy&

Note that the Evernote one is custom. To create one for your own account, try the following:

  1. Log in
  2. Do a search
  3. Find and replace your query with "%s"

I don't understand why they make that so hard, but at least it seems to work (an improvement from a year ago):