How to Add OpenSearch to your Website or Blog

February 15, 2007 2 min read

The latest versions of Microsoft Internet Explorer and FireFox offer a powerful new feature: they allow you to run a search directly from the browser without having to open a Google or Yahoo page. This is handy and convenient, and can save us a few clicks for every search we run (several per day, in my case).

The new feature is based on an open standard called OpenSearch. It’s based on a simple yet effective idea:

  1. A website owner adds a little XML file to his/her website and a simple tag (auto-discovery link) to the main web pages describing a new search engine or a specific search option for an existing search engine.
  2. As new generation web browsers visit the website, they automatically recognize the tag and load the XML file.
  3. The XML file is parsed and, if syntactically correct, a new entry is temporarily added as an option to the search menu of the web browser.
  4. The visitor/user can customize the web browser adding the new search option as a permanent entry of the search menu.

It’s very simple. If you don’t have a new search engine running on your servers, you can set up the OpenSearch configuration to run a search on your website using Google as the search engine.

First you have to create the simple XML file. I suggest you start from a template. The one I use is below (thanks to DeWitt Clinton):

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>[Site Name]</ShortName>
<Description>Use Google to search [Site Name]</Description>
<Tags>[Site Name]</Tags>
<Url type="text/html" template="http://www.google.com/search?q=site:[Site URL] {searchTerms}"/>
</OpenSearchDescription>

Now you have to replace [Site Name] with your website name and [Site URL] with your website URL. Here is the Novedge XML file:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Search Novedge</ShortName>
<Description>Use Google to Search NOVEDGE</Description>
<Tags>NOVEDGE</Tags>
<Url type="text/html" template="http://www.google.com/search?q=site:novedge.com {searchTerms}"/>
</OpenSearchDescription>

Save the XML file with the .xmlextension, and copy it onto your website. Now you only need to add a simple tag to the HEAD section of your web pages. This is the template of this auto-discovery link:

<link rel="search" href="[XML File URL]" type="application/opensearchdescription+xml" title="[Site Name]" />

For example, here is the Novedge auto-discovery link:

<link rel="search" href="/opensearchdescription.xml" type="application/opensearchdescription+xml" title="Search NOVEDGE" />

Now you’re done! Refresh your browser and then check it. Here is what you should see (FireFox):

From now on all your visitors will have the choice to add a search to your website as a standard option of their web browser. At Novedge, for example, we believe this is important. We have a huge catalog with more than 1500 products so we’d love to make our catalog searchable through Google.
You can try OpenSearch on our Novedge website.  If you decide to add this feature to your website let me know by leaving a comment to this post. For more details about OpenSearch, please visit the OpenSearch pages on Wikipedia or the OpenSearch website.

Franco Folini

Franco Folini
Franco Folini


Also in NOVEDGE Blog

Subscribe