Adding OpenSearch to your website and getting in the Browser's Search Box
I was over at http://search.twitter.com earlier today and I noticed the Search Box in Firefox had a blue lit-up dealie:
Hm...OK. What's that? I hit another site and didn't see it. Weird. Ok, View-Source then, what drives you little blue thing?
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="Twitter Search">
Hey, that's not something I've seen before. What's in it...http://search.twitter.com/opensearch.xml...
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Twitter Search</ShortName>
<Description>Realtime Twitter Search</Description>
<Url type="text/html" method="get" template="http://search.twitter.com/search?q={searchTerms}"/>
<Image width="16" height="16">http://search.twitter.com/favicon.png</Image>
<InputEncoding>UTF-8</InputEncoding>
<SearchForm>http://search.twitter.com/</SearchForm>
</OpenSearchDescription>
Ah! I totally get it. Excellent. I shall make my own immediately! I added this file to my website and added a <link> line as seen in the first example above that pointed to it.
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>Hanselman Search</ShortName>
<Description>Search Scott Hanselman's Blog</Description>
<Url type="text/html" method="get" template="http://www.hanselman.com/blog/...snip...q={searchTerms}"/>
<Image width="16" height="16">http://www.hanselman.com/blog/favicon.ico</Image>
<InputEncoding>UTF-8</InputEncoding>
<SearchForm>http://www.hanselman.com/</SearchForm>
</OpenSearchDescription>
Bam.
I wonder if it works in IE7?
Pow! I wonder if Live.com supports it?
Eek! FAIL. I'll mention that to someone at Live.com
OpenSearch is a really easy feature that you can add to your website in literally minutes. Seconds if you type fast. Check me out noticing this only three years late. :)
Give it a try!
IMPORTANT NOTES: Make sure you include the first line of the XML file (the XML declaration) or IE will ignore it and nothing will happen when you add it. Also, make sure you include the default XML namespace or Firefox will give you an error: "Firefox could not download the search plugin"
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
I still tell people about the orange down-arrow in IE7, which appears next to the search field when it finds an OpenSearch provider, and they get amazed. It was only a few months I told some of your colleagues here in Sweden about that at a search seminar held at the Microsoft campus.
and ie had it before firefox :O cant say that about many standards :)
IMO its worth investigating the many other features of OpenSearch.
OpenSearch is great, and so easy to implement - I wrote a provider for our product in my lunch hour, handed it over to the dev guys (for real coding - error handling, an all that boring stuff.. ;-) and the PR we got was incredible. Also, integration with MS Search Server and SharePoint comes free!!
.. Ken
http://www.amrelsehemy.net/post/2008/03/26/Yet-another-BlogEngineNET-feature-that-I-love.aspx
http://developer.mozilla.org/en/docs/Creating_OpenSearch_plugins_for_Firefox
Which will give you that awesome auto-suggest you see with the "out-of-the-box" Google provider in FF.
In Opera: right click on any search field.
Choose "Create search"
Optional: alter the description and/or give a shortcut name
Click Ok
Now I can go "S OpenSearch" in my address bar to search on scott hanselman's site and search for Opensearch.
Or use the search engine search box like other browsers have.
Or select a word in a webpage, rightclick and go "search with Scott Hanselman"
Although I like that there is a standard for it for developpers to give some way to customize it, I think it is a bit redundant seen previously mentioned technique has worked for years without any effort from the devoloper.
As always: this is my opinion, but I'm more then willing to change it
Make any pages' search functionality available in the Search Bar (or "search box")...
https://addons.mozilla.org/en-US/firefox/addon/3682
http://tips.developersvoice.com/devsearch
This developers search engine is inspired by searchdotnet.com and I try my best achieve even batter results. Both these developers search engines would greatly help the developer’s community.
DO test it yourself and let me know your comments.
Comments are closed.