Very Excited about... Custom Search Providers in IE 7

I tried running IE 7 beta 1 but gave up as it had one critical bug that prevented me from developing any ASP.NET code (and wouldn't work with a number of websites, too).

As you probably know by now, IE 7 beta 2 is now out; I had been told this one bug had been fixed (as had many others, presumably) so gave it another try as soon as it was available. That was a couple of weeks ago now and I must say it's a very compelling browser - I'm very pleased with it and have not had a single problem yet.

One thing I noticed about IE 7 that I like is the little search box on the top right, with a drop down from which you can select your search engine of choice; just like Firefox. Very nice! Like Firefox, you can also add new search providers. I am trying out Windows Live Search now, which seems to give very good results actually and is now my default Search Engine. I've even set Windows Live to be my default page - it used to be Google (as I search for stuff so much in my line of work). One thing I like about the Google page is that it is really simple and loads very quickly. Windows Live has a feature where you can just hide everything (like Weather, Stock Quotes, news etc. that you might have set up) in order to get this quick-launch experience. (It's under "Settings" on the top right - just select "Always start with pages hidden" to make use of this.)

Anyway I digress - what I am really exited about is how easy it is to allow users to make use of your own search engine, from this same Search Box. So for example if you have a web site and offer one of those "Site Search" boxes on the top right, you can allow users to search this engine right from their Browsers! The best part is that it is trivially easy. First of all you create an XML file like this:

<?xml version="1.0" encoding="UTF-8"?><OpenSearchDescription xmlns="https://a9.com/-/spec/opensearch/1.1/"><ShortName>My Site Search</ShortName><Url type="application/rss+xml" template="https://www.yoururl.com/MySearchResultPage.aspx?q={searchTerms}"/></OpenSearchDescription>

Note that "MySearchResultPage.aspx" and the parameter passed in are examples; you should configure those to whatever generates your search results and change the "q" parameter to whatever your page uses to accept a string to search upon. If there are other parameters yours Search Page expects, then you can add them in here too. The words in "ShortName" are what appears in the IE 7 Search box to describe the Search Provider.

Once done, place this file on a web server somewhere where your users can get to it. Then place a link somewhere prominent on your site like this linking to your file like this:

Click <a href="javascript:window.external.AddSearchProvider('https://www.yoururl.com/MySearchProvider.xml')">here</a> to add YourUrl.com's site search as a Search Provider in IE7!

I use code to examine the USER-AGENT of the users' browser to ensure it is version 7 or higher before displaying this link as it won't be of use to anybody running an older version of IE.

Once done, a user (using IE 7) who clicks that link will get a prompt asking if they would like to add the Search provider; if they accept then it appears in the list at the top of their browser like all the others. Simple, and very effective!