How to Create a Firefox Search Plugin (Extension)
by Victor | September 28, 2008 in Applications, Firefox | 3 Comments
The Firefox browser (as of version 3.0.2 and likely earlier versions), there is a search bar at the top right. Custom search engine plugins are available to allow easier searching. For this example, I will demonstrate how to create search engine for the search engine Scour. We will begin with a template which should be copy and pasted into an xml file (in our case, it will be scour.xml).
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> <ShortName>engineName</ShortName> <Description>engineDescription</Description> <InputEncoding>inputEncoding</InputEncoding> <Image width="16" height="16" type="image/x-icon">engineImage</Image> <Url type="text/html" method="method" template="searchUR" /> </OpenSearchDescription>
Now that we have our template, we need to make custom changes for our search engine. We will go through each of the colored changes:
engineName
This simply shows the search engine name that appears on the browser in gray before a search term is entered. In our example, the search engine name is Scour.
engineDescription
This one is a search engine description. Scour’s search engine description is, “Search Socially”.
inputEncoding
This is the encoding for the search engine. In most cases, this should be “UTF-8″.
engineImage
This is the image that will represent the search engine. Note that generating this portion will most likely require an online tool. The image should be a 16×16 or 32×32 image converted to type image/x-icon. The template above is cofigured for a 16×16 images. Be sure to adjust the width and height to 32×32 if you decide to use a 32×32 sized icon. An example of a suitable image is the search engine’s default shortcut icon found in the the meta information of the website. To generate the text representation of the image, go to The data: URI kitchen. Below is a quick tutorial on how to use use URI kitchen:
- Insure that the “base64″ checkbox is checked.
- Either insert an online http link to the image or browse to a local copy on your computer in the correct input field.
- Click the Generate button. Note that the result required for engineImage field will be outputted to your browser’s Location Bar (URL bar).
- Copy and paste the result into your xml document.
searchURL
This is the most important field and will determine whether your search plugin correctly performs a search. Because each search engine is different, we will go through a step by step process of how to obtain this information for the Scour search engine.
- Go to their main website at Scour.com.
- Input the following search term without the quotes: “findMe”. Click Search.
- On the search results page, we will examine the URL. As of the writing of this document, the resulting URL was: http://www.scour.com/search/web/findMe.
- We then want to replace the string “findMe” with “{searchTerms}”. The result of this step (and the searchURL data) should be: http://www.scour.com/search/web/{searchTerms}.
We have now completed the xml file for our search engine. We will now go through the process of testing to ensure that our Firefox Search Plugin works:
- Make sure your XML file is free of errors by opening the file in Firefox (should be as easy as double clicking on the xml file in windows explorer or your windows desktop). If you have problems at this step, the most common errors is a tag might be overwritten.
- Assuming Firefox 3.0.2 was installed into it’s default directory, the local directory to place this xml file is: C:\Program Files\Mozilla Firefox\searchplugins.
- Restart the Firefox browser.
- On the fresh Firefox browser load, check the search engine dropdown to see if your newly created search engine is there. If the search engine image is blank, verify that the information you used for engineImage is correct. Recreate another copy if you have to!
This just about sums up how to create a Firefox Search Engine plugin. Let me know how this works!




