The Code
Maybe you're a fan of the Yahoo! Image Search (http://images.yahoo.com) and you'd like to be able to search for images quickly from Firefox. The first step in creating a custom entry is to perform a search and take a look at the URL. For this example, browse to http://images.yahoo.com, type Shakespeare into the search form, and click Search Images. You should receive a page full of various pictures of Shakespeare, but take a look at the URL in the address bar. The relevant pieces of the URL include the images.search.yahoo.com domain, the images file, and the p variable, which is set to the search query:
http://images.search.yahoo.com/search/images?p=shakespeare
Now that you know how Yahoo! Image Search URLs are constructed, you can write the file that will tell Firefox where to send search requests. Create a file called yahoo_image.src in a plain-text editor such as Notepad, and add the following code:
# Yahoo! Image Search
#
# Created April 16, 2005
<SEARCH
version="7.1"
name="Yahoo! Image Search"
description="Search for images at Yahoo!"
method="GET"
action="http://images.search.yahoo.com/search/images" >
<input name="p" user>
</search>
As you can see, this quick file begins with an opening <SEARCH>tag that holds the name of the search, and a brief description. Everything before the question mark in the search results URL becomes the value of the action attribute. The input tag lets Firefox know the value should come from user input and that it should be named p, as in the Yahoo! Image URL.