One really useful thing I came across at IWMW 2008 was the ability to put your own site’s search into the browser’s list of search tools. You know, that little google box in Firefox where you can in fact bring down a list of other search engines. That can have your site’s search tool in there too.
This makes use of OpenSearch, a collection of simple XML formats for sharing search results.
Basically achieving your super-cool goal is a very easy three step process. Make a small web-accessible XML file on your web server with the right magic in it, then put a link to that file in your html header, much like you would if you wanted your RSS feed to appear as a button in a browser.
Step 1: work out your own search url
OpenSearch uses a special syntax for the search url, of the form:
http://example.com/search?q={searchTerms}
So for my blog, the search url is http://matthewbull.net/?s={searchTerms}
Step 2: make your xml file
<?xml version=”1.0″ encoding=”UTF-8″?>
<OpenSearchDescription xmlns=”http://a9.com/-/spec/opensearch/1.1/”>
<ShortName>matthewbull</ShortName>
<Description>my blog search</Description>
<Url template=”http://www.matthewbull.net/?s={searchTerms}” type=”text/html” method=”GET” />
<Image height=”16″ width=”16″ type=”image/vnd.microsoft.icon”>http://www.matthewbull.net/favicon.ico</Image> <OutputEncoding>UTF-8</OutputEncoding>
<InputEncoding>UTF-8</InputEncoding>
</OpenSearchDescription>
where the ShortName and Description are up to you, and Url was the url you made in step 1.
Save this as an xml file to your server.
Step 3: tell the browser about your xml file
Now just put a link in your html to tell your browser where your xml file lives:
<link title="matthewbull.net" href="http://matthewbull.net/opensearch.xml"
type="application/opensearchdescription+xml" rel="search">
And that’s it! Happy searching.

