Mozilla & Internet Explorer Search Plugin's / Opensearch Tutorial

Date: Apr 07 2009

Let’s keep this one real quick and simple. Since I love to shop for the best price and I am lazy I wanted to make a Pricegrabber quick search tool for Firefox or Internet Explorer 7 because there was none to be found.
Since it was so easy and I didn’t find any good tutorials I figured I would write one up. Ok so lets dig into this.

The opensearch item is nothing more than an xml file with a couple attribute.

search3
The only three meaningful parts to get things working are the Image section, Search Url and Search String.

 
 
	Pricegrabber
	Pricegrabber - Comparison Shopping
	UTF-8
	<img alt="" width="16" height="16" />data:image/x-icon;base64,AAABAAEAEBAAAAEABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAPiIgAAAAAAAeIiId3AAAAd4CIAAiPAAB4AAiHiIcAAIiICP+AgAAAf3h49wCAAAAAiH/3gAAAAACIh3eICAAAAIiIiAiAgAAAgIeICIAHAAAIcHgICIAACAcACIAAiICAcAAAAAAIiIgAAAAAAACADwAAAAAAAHj//wAAg/8AAIA/AAAADwAAAA8AAAAfAAAAHwAAwB8AAMAPAADABwAAwAMAAMQjAACOcQAAH/gAAD/8AAC//AAA
 
 
 
	http://www.pricegrabber.com/

To understand it in a http type format

http://www.pricegrabber.com/search.php?form_keyword=commodore+64

Url > template is the path to the search script, similar to your post action for a form
form_keyword
is the form field that would be the search text
Image: here you either have the option to do a hard link to a png/ ico file or encode your ico/png right into the xml file. This is probably the most favored method.

Using option one the hard link to your icon file your image arrtibute would look something like this

&lt;Image width="16" height="16"&gt;<span class="attribute-value">http://ai.pricegrabber.com/favicon.ico</span>&lt;/Image&gt;

The other method encoding your ico/png file you would need to get your icon file and use
a <a href="http://www.motobit.com/util/base64-decoder-encoder.asp" target="_blank">base64 binary encoder</a>.

&lt;Image width="16" height="16"&gt;data:image/x-icon;base64,paste image data here&lt;/Image&gt;

Its pretty simple and if you want to make a quick search for you any site all you have to do is have a look at their search form.

search2

Our xml opensearch would look something like this

 
 
	Backcountry
	Backcountry - Outlet for Outdoor gear
	UTF-8
	<img alt="" width="16" height="16" />http://content.backcountry.com/images/icon/bcs.ico
 
 
 
	http://www.backcountry.com/

Now lets go over how to have the end user have a nice simple install.

There are two options at hand and you can use both.

OPTION #1
make a <a> link that can install like this one.
add the pricegrabber search engine – It’s pretty easy and this works for IE7+ as well.

?View Code JAVASCRIPT
<a href="javascript:window.external.AddSearchProvider('http://url_path/opensearch_file.xml');">add the engine</a>

OPTION #2
Have auto discovery of search engine plugin embedded in your page like this. which resides in the head of your html pages.
search4

?View Code JAVASCRIPT
 

LIST OF MY CUSTOM OPENSEARCH PLUGINS

Chemlab Blog – Auto Discovery Set

Backcountry.com OpenSearch Install – coming soon

dogfunk.com OpenSearch Install – coming soon

Newzbin Opensearch Install

Pricegrabber.com Opensearch Install

Be Sociable, Share!

facebook comments:

2 Comments to “Mozilla & Internet Explorer Search Plugin's / Opensearch Tutorial”

  1. Oleg 4 June 2009 at 7:09 am #

    what about IE? How to automatically add open search to it?

  2. undertoe 4 June 2009 at 8:05 am #

    should be the same for IE


Leave a Reply