ARTICLES

Powered by Anchor

Add your search engine to Firefox with OpenSearch

Everyone wants to add its own search engine to the Firefox Taskbar like Youtube does :

youtube_search.png

I searched through different websites code sources, such as php.net, developer.mozilla.org or https://wikipedia.org and found one same line of code in the head tag : Opensearch

OpenSearch is a collection of simple formats for the sharing of search results. They have a detail manual is available on their website (http://www.opensearch.org/Home)

I first thought it could be it was tough to code such a thing but not at all!

All you need is an xml file and a single HTML line of code in you head :

<link rel="search" type="application/opensearchdescription+xml" href="/link/to/your/file.xml" title="My search!">

and the xml file is a simple description page to your search page :

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">
  <ShortName>a short name</ShortName>
  <Description>My website search</Description>
  <InputEncoding>UTF-8</InputEncoding>
  <Image width="16" height="16" type="image/x-icon">/link/to/your/favicon.ico</Image>
 <Url type="text/html" method="get" template="http://example.com/?q=" />
</OpenSearchDescription>

Of course you can modify the format of the search: Atom 1.0 or RSS2.0

More on their GitHub here : [https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#opensearch-description-document]

I use mine in order to search through this blog. When everything is uploaded correctly on your website, just look at the search icon of your search bar and a + should appear !

Now the only thing you have to worry about is doing the search page!

Thanks for reading!

Hope you enjoyed,

TheRolf

This article is my oldest. It is 205 words long, and it’s got 115 comments for now.