2008-12-08

Adding a search provider for searching Gmail from the browser

Adding search engines to the browser (in the top-right search field in most browsers) may be done by creating an xml file containing an Opensearch description and then adding them with a javascript method call.

The below button adds a search provider for searching gmail:



The javascript call is
window.external.AddSearchProvider('http://fornwall.net/files/blog/gmail-search-provider.xml');
where the xml file is as follows:
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Gmail</ShortName>
<Description>Search Gmail</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">https://mail.google.com/favicon.ico</Image>
<Url type="text/html" method="GET" template="https://mail.google.com/mail/#search/{searchTerms}"/>
<moz:SearchForm>https://mail.google.com/mail/</moz:SearchForm>
</OpenSearchDescription>

No comments: