FireFox custom search engines
FireFox custom search engines
If you haven't already noticed there's a search engine quickbar next to the urlbar in FireFox 2 This can be used to search quickly for ex. Google or Wikipedia.
Sometimes when you go to a site the searchplugin list button may turn blue. This means you can add some of that site's functions to the quickbar.
"But how does FireFox know that there is a searchplugin available?" Well, it's done with simple code in the HTML head:
<head> <link rel="search" type="application/opensearchdescription+xml" href="Searchplugin XML file url" title="Searchplugin title" /> </head>
"How do I make a searchplugin then?" For this you need to write an XML file that contains the instructions for FireFox, so that it knows what to search and where. Here's an example of my own XML file:
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/"> <os:ShortName>My own searchplugin</os:ShortName> <os:Description>My own searchplugin</os:Description> <os:InputEncoding>UTF-8</os:InputEncoding> <os:Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJkAAIAA/xwAN7dv/////yH5BAEAAAMALAAAAAAQABAAAAIynA2px6O/WAoCUnCmuPoiQHHgVjmjdqbpxYmuW6ETrIiQalulrGNmjsqogpJbpGF6NAoAOw==</os:Image> <os:Url type="text/html" method="POST" template="http://www.someexamplesite.com/index.php"> <os:Param name="search" value="{searchTerms}"/> <os:Param name="page" value="1"/> </os:Url> </SearchPlugin>
And broken down:
<os:ShortName>My own searchplugin</os:ShortName> <os:Description>My own searchplugin</os:Description> Your searchplugin's name and description. If I remember it right the name will show up in the searchplugin list and description shows up in the search field if it's blank.
<os:InputEncoding>UTF-8</os:InputEncoding> The encoding. You'll probably keep it this way, but if you use some special characters you have to change it.
<os:Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJkAAIAA/xwAN7dv/////yH5BAEAAAMALAAAAAAQABAAAAIynA2px6O/WAoCUnCmuPoiQHHgVjmjdqbpxYmuW6ETrIiQalulrGNmjsqogpJbpGF6NAoAOw==</os:Image> This is the fun one :D you get to draw your own icon for your searchplugin! I assume that it should be a 16x16 .ico file. If you are not familiar with how to create icons this may be a bit more difficult. Anyways the icon is encrypted with base64 so it always goes with the XML file. You can encrypt your icon with this: http://www.motobit.com/util/base64-decoder-encoder.asp and when you're done with it just put the code between "base64," and "<".
<os:Url type="text/html" method="POST" template="http://www.someexamplesite.com/index.php"> This one is the page that you want to post your search in. You may have to change POST to GET on some sites.
<os:Param name="search" value="{searchTerms}"/> <os:Param name="page" value="1"/> These are the inputs for the search form. This is probably the most annoying part. You have to go to that site defined above and find and write all form fields that are necessary for the search in here. The form field that has the search term is going to have {searchTerms} as value.
Now you can add your searchplugin to FireFox the way I mentioned first or manually by putting the XML file directly into FireFox "searchplugins" folder which is located in FF profile folder.
"What's the use? I don't know any site I could use this on" Well this could be useful with ex. yellowpipe or maybe even HBH search functions.
- Mouzi