OpenSearch, how to get Google Chrome to search your site.

Ever wonder how sites like support things like this in Google Chrome?

Well I did, so I did a little bit of digging. It turns out Google Chrome supports an open standard called Open Search. This format is relatively simple, and very easy to add to your own site. I just added it to some of our systems in under 5 minutes.

Adding OpenSearch to your site is incredibly simple, you just have to add a simple tag to your index HTML page, and add a simple XML file that it points to. The link tag looks like this:

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

The opensearch.xml file looks something like this:

<OpenSearchDescription xmlns="" xmlns:moz="">
   <ShortName>My Site</ShortName>
   <Description>Search My Site</Description>
   <Url type="text/html" method="get" template="{searchTerms}"/>
   <Image height="16" width="16" type="image/">
   <Url type="application/opensearchdescription+xml" rel="self" template=""/>

And that's all, the first time someone visits your site, the link tag will be registered, and following attempts to type in that URL will provide them with the option to search (chrome), and it will nicely integrate with other search services as well.