Create a Plugin, with a custom search engine. How to add a Search Engine to the Toolbar


Google CSE


  • If you have a Custom Search Engine or AdSense for Search in your page, it is possible to add the Search Engine to the Toolbar (Firefox 2 and IE 7)

Find a Wine with Google CSE



  • The Plugin is an xml file which follow the syntax of OpenSearch :


<?xml version="1.0" encoding="UTF-8" ?>

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">

<ShortName>2 or 3 words</ShortName>

<site>URL target when user send an empty query</site>

<Description>Short description</Description>

<Image width="16" height="16">data:image/x-icon;base64,XXX...XXX</Image>

OR

<Image width="16" height="16">type="image/gif"
URL</Image>

<LongName>Long title of Search Engine</LongName>

<Developer>Author</Developer>

<SyndicationRight>open</SyndicationRight>

<AdultContent>false</AdultContent>

<Language>en</Language>

<InputEncoding>UTF-8</InputEncoding>

<OutputEncoding>UTF-8</OutputEncoding>

<Url type="text/html" method="get"
template="URL/?q={SearchTerms}"></Url>

</OpenSearchDescription>


How to create the tags


  • Use Ready2Search to generate the tags. This tool create the base64 encoding for the picture. It's better to have this encoding, to not load the picture every time the plugin is used
  • For the Url tag, you need to use your Search Engine with a keyword. Let's try with an example. I search for cabernet. In the adress bar, I have this URL :
http://www.google.com/custom?hl=en XXXX ... XX
&q=cabernet
XXXX


  • The adress until (inclusive) &q= is the Prefix of the template. The part after cabernet is the Suffix. Ready2Search generate for you the Url tag like this :
http://www.google.com/custom?hl=en XXXX ... XX
&q={SearchTerms}
XXXX

  • Download the setting, and upload the xml file into your site
  • An example of Opensearch xml file


Autodiscovery of the Plugin


  • To support autodiscovery add this link tag :


<link rel="search"
type="application/opensearchdescription+xml"
title="Title of Search Engine"
href="http://YOURSITE/YOURPLUGIN.xml>

  • If autodiscovery is active, the search bar will ask to add the new Search Engine


Create an anchor to add the Plugin


  • To offer the ability to manually add the Plugin, create an anchor, using AddSearchProvider (Firefox 2 and Internet Explorer 7) :


<a href="#" onclick="window.external.AddSearchProvider(
'http://YOURSITE/YOURPLUGIN.xml');">

  • And the result :

Add this plugin to your toolbar


More on Google CSE





One Day - One Label - One Wine