Thursday, April 16, 2009

How to write custom search plugins for Firefox?

If you are fond of using Search bar in Firefox, this is for you.

For Users
As an user you might need to search on a particular site frequently. In such cases, you can write your own custom search plugins for Firefox and perform searches right from your browser. To do that, you just need to write a simple text file (.src) containing the following information and place it inside the 'searchplugins' directory of Firefox installation :
  • Search URL - If the site, you want to search for, provides a search option, you can use the URL of the same. For example, in all the blogger based blogs $blog_url$/search is the search URL. Otherwise, you can use the site search option of Google using site: operator with http://google.com/search as your search URL.
  • Search query parameter - Search query is generally passed to the search URL as a parameter. You should know the parameter name. Most of the search APIs use 'q' for this.

Check out all the available options here. You can try it out yourself for Twitter search.

For Web Admins
You can advertise your site's search plugin so that Firefox users can easily download and install the plugin. To support auto discovery, you simply need to add the below line to the <head> section of your web page:


P.S.: Remember to restart the browser after installing any new plugins.

--Varun

2 comments:

  1. gr8 stuff :) Just tried
    works for browsers built on Web Kit say chrome?

    ReplyDelete
  2. Havent tried with Chrome. But, it will work with IE7

    ReplyDelete