Customising the Internet Explorer Address Bar

Update: As you can probably tell from the “Updated on ‘Thu Jul 22 16:03:01 2004’” I’ve not touched this page for a while. I assume these no longer work so I’ve removed links to the executables and the executables themselves.

Love it or hate it IE is one of those things that’s here to stay, at least for the foreseeable future, so why not make it work a little more to our liking? I’ve already put up some of the plugins that make my life a little easier (and help to reduce Mozilla envy!) so now its time to cover the address bar.

Considering how much desktop real estate the address bar requires it is actually pretty weak in the functionality it provides. In eariler versions of IE(5 and 5.5) a search for the Microsoft Knowledge Base was included, but this functionality was removed in IE 6 to allow for more remote exploits to be crammed in (sorry, a little bias slipping in. :)) On this page I’m going to show you how to add your own searches, all that’s required is a little registry hacking, and upload any of my own for your perusal.

To show you how easy it is to extend the IE address bar in this way we’re going to step through adding a search for the CPAN sites list of modules. I do a fair amount of Perl so knowing whats on CPAN can save me days at a time of reinventing wheels.

There are three main ways you can do this, you can create a registry file and load that in with a simple double click, you can hand edit the registry values with regedit/regedt32 or you can download somebody else’s nice, packaged installer. To show you exactly how it works, and because you’ll never find a pre-written extension for that site you really want, we’ll do both.

Creating a Registry File: Create a new plain text file (using which ever editor you like, vim’s always a good choice!) and either download the file here (and remove the .txt from the end of the filename once downloaded) or enter the text exactly as shown below (without the dotted lines):

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\cpan]
@="http://search.cpan.org/search?query=%s&mode=module"
":"="%3A"

Stepping through the text, the first line of importance begins with ‘[HKEY_CURRENT_USER', this is the location in the registry where the search will be added. At the end of the line you can see the string ‘cpan’, this is the phrase you will enter into the IE address bar to activate the search; try to pick a short, memorable phrase.

The next line is where all the actual work is done, the URL points to the cpan search page and includes the full query string required to make it return sensible results. All the ‘magic’ is done with the ‘%s’ embedded in the string, this takes the argument you provide in the address bar and passes it into the query string. If you invoked the search like this ‘cpan Test::Warn’ then the actual search would be ‘http://search.cpan.org/search?query=Test::Warn&mode=module'

The last line does a little clean up of the search criteria, there are a number of characters that shouldn’t show up in a query string and ‘:’s are one of them, unfortunately most Perl modules contain at least two in their names. By adding the ' “:“=”%3A” ' mapping any colons are escaped before the query is executed. Now you have the full file to enable it just double click the .reg file and you’ll be prompted for permission to add the new entries, click ok and then you’ll be shown a prompt telling you everything is working. Once you’ve done this skip to the “Trying it Out” section.

Editing The Registry by Hand: This approach is a little faster, gives more immediate feedback but is harder to reproduce as you lack the nice, separate file with the your settings included. Open up your registry editor of choice and navigate to the ‘HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl’ key. Once there add a new key named ‘cpan’ this is the phrase you will enter into the IE address bar to activate the search; try to pick a short, memorable phrase.

When you look at the contents of the ‘cpan’ key you will see a default key, this is where you should place your fullURL, including both query string and the %s. Once this is done create a second key of type string, this is going to hold the mapping that causes any :’s passed in to be escaped to ‘%3A’. If you need to set up any other escapes such as spaces, math operands or similar you add another key with the desired mapping. Once both of these are finished close your editor.

Trying it Out: Now you’ve done all the hard work lets aim for that warm fuzzy glow that lasts for about twenty seconds before you go and check your email for something a little more interesting. Open IE and click in the address bar, type ‘cpan Test::Warn’ and watch as you are whisked away to the results page.

While CPAN might not be a frequent stop in your browsing the principles are applicable to almost any site that exposes a search page, cinemas, jobsites and even obscure little sites like Amazon can be bolted in with a minimum of effort.

Below you will find links pointing to some working examples of Addressbar customisation, each one consists of three files:

  • Reg file
  • Executable (with an uninstaller built in)
  • NSIS script

The reg file is the simplest of the three options, download it, remove the .txt from the end and then double click to install. You will be prompted to continue and then you’ll be shown a message box with the results. The executable is a little larger but is a simple double click to install and provides an uninstaller (both as a file and an entry in Add/Remove Programs) that can be used to back out the changes.

The third option is an NSIS script, this is how the executable is generated. I’ve included it here for no other reason than examples are worth a lot of text and NSIS is actually pretty good.

Mailinator: I love mailinator, it makes temporary throw away email addresses so easy its worrying. Being able to call it from the IE address bar makes checking it a one click trick. Just enter “mail address” to open a window on the mailbox for the supplied address.

  • Mailinator Reg file
  • Mailinator executable
  • Mailinator NSIS Script

UKLug – Beta Version: UKLug is a job search site that gathers job information from a number of sources. What makes it special? Two things, it allows RSS subscription to your search term and a huge corporation doesn’t own it.

  • UKLug Reg file
  • UKLug executable
  • UKLug NSIS Script

CPAN: The CPAN example we used in the above text can be found here:

  • CPAN Reg file
  • CPAN search executable
  • CPAN NSIS Script

Google: No example is complete without Google bindings, or at least it seems that way these days. Ever willing to oblige here they are:

  • Google Reg file
  • Google search executable
  • Google NSIS Script

This was first posted on ‘Fri Sep 12 16:06:30 2003’ by Dean Wilson.