In addtiton to my first post “Windows 7 Federated Search” I would like to show you another way how you could make use of opensearch.

Well Firefox and Internet Explorer support both the opensearch specification, which let us customize the browser’s search box.



OpenSearch is a collection of simple formats for the sharing of search results.

The OpenSearch description document format can be used to describe a search engine so that it can be used by search client applications.

The OpenSearch response elements can be used to extend existing syndication formats, such as RSS and Atom, with the extra metadata needed to return search results.

Opensearch Article Searchprovider Screenshot
Add Searchprovider Screenshot

It’s quite simple as you will notice on the following lines. At the end of this post you will be able to add your own site to the browser’s search box.

On the screenshot to the left you can see the typical drop down menu which appears when you click on the browsers search-box. Well, the last entry shows my site which you could to add to the browsers search box.

The first thing will be to creating or editing a template file.

Create a template

Creating the template file is rather easy because its just a simple xml file.

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="">
 <Url type="text/html"
      template=[Template Url]/>
<Image height="16" width="16" type="image/">

Replace [Site-Name], [Template URL], [Tags] and [Description] and if you like you can also specify a small icon in [Iconpath] in the template above adapt the values for your site. Remember that [Name of site] must be 16 or fewer characters of plain text.


<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="">
 <Url type="text/html"
<Image height="16" width="16" type="image/"></Image>

Autodiscovery Link

Now we need to make sure that the browser’s which visit our site get notified about the new search engine using the autodiscovery link. The best way doing it would be to insert it inside of your template’s header.php since we need it on every page to be included.

Place the following directly between your <head> </head> tags of your header.php.

<link rel="search" href="[URL of the file you just created]"
      title="[Site name]" />

For example, on private-storm pages this line appears as:

<link rel="search" href="opensearch.xml" type="application/opensearchdescription+xml" title="Private-Storm" />


Another way of adding your site to the browser’s search box using the template above is to wrap it into a function which you can call from a link on a specified page of your site.

function AddToSearchbox() {
if (window.external && ("AddSearchProvider" in window.external)) {
} else {
alert("Your browser does not support search providers, you may want to use Firefox or Internet Explorer 7 or above");


We first check if windows.external and the function “AddSearchProvider” exists. When using Firefox or Internet Explorer 7 they are already existing! Then the function is called and the searchprovider is added.

We can create a link on our site which makes it easy to call the newly created function like:

<a href="#" onclick="AddToSearchbox()">Click to add the search provider to the browsers search box</a>