Monday, August 28, 2006

Writing your own custom Firefox Search plug-in

Although there are literally thousands of search plug-in's which are readily available to the majority of sites, some times you confronts a situation where you don't find the search plug-in you are looking for. This post is for those of latter category. Now let's start writing a custom search plug-in lets say.... for ''. First of all create a text file and type the following code (will explain line by line below):

description="Search Dictionary"

<input name="q" user="">


The code starts with a search tag and the version number is the latest Mozilla Browser version number which is 8.1. Next is name and Description of the plug-in which are pretty straight-forward. Now just go to the site for which you want to write the search plug-in and enter some data and closely look at the website URL. The action value is the link that corresponds to the website address untill the question mark (?). In our case it is ''. Next the SearchForm value is the basic website URL. The method by which you are posting the data to the server is 'GET'. Untill now we did the ground work for the plug-in. Next task is to link the values that you enter to the plug-in.

Again give a closer look to the website url when some search parameter is entered. If we give 'boulevard' as the search parameter it will result in the following website URL ''. Note the values for which the search parameter is assigned after the '?' mark. In our case it is 'q' for which our search parameter is being assigned. Now assign 'q' to 'name' in the input tag and leave the 'user' value empty. Now end the search tag.

Once you completed all this save the file as 'Dictionary.src' at "C:\Documents and Settings\Administrator\Application Data\Mozilla\Firefox\Profiles\yourprofile\searchplugins" in Windows or whatever your profile location for FireFox. Now restart your firefox and you can see your custom written plugin among the list of other search plug-in's in the right side top corner of the browser window. You will also notice that there is no image to our search plug-in. Don't worry you can add your own image, download or make some image and name it as same as the search plug-in file name and save it in the same search plug-in directory(Be aware that the image size should be around 16 x 16 pixels. Otherwise it will appear ugly in the search tool bar).

1 comment:

viv said...

great piece of information!!!
thank you very much.