Firefox 2 uses a simplified form of the OpenSearch format for storing search plugins. A MozSearch search plugin is an XML file that describes the search engine, its URL, and the parameters that need to be passed to that URL.
The plugin file
The MozSearch format is similar to the OpenSearch format. The only difference is the root element and XML namespace.
Example: searching Yahoo!
The following XML is the bundled Firefox 2 search plugin for searching using Yahoo!:
<SearchPlugin xmlns="https://www.mozilla.org/2006/browser/search/"> <ShortName>Yahoo</ShortName> <Description>Yahoo Search</Description> <InputEncoding>UTF-8</InputEncoding> <Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAJECAP8AAAAAAP///wAAACH5BAEAAAIALAAAAAAQABAAAAIplI+py+0NogQuyBDEnEd2kHkfFWUamEzmpZSfmaIHPHrRguUm/fT+UwAAOw==</Image> <Url type="application/x-suggestions+json" method="GET" template="https://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}" /> <Url type="text/html" method="GET" template="https://search.yahoo.com/search"> <Param name="p" value="{searchTerms}"/> <Param name="ei" value="UTF-8"/> <MozParam name="fr" condition="pref" pref="yahoo-fr" /> </Url> <SearchForm>https://search.yahoo.com/</SearchForm> </SearchPlugin>
Let's say the user chooses to use the Yahoo! search engine plugin and enters "mozilla" in the search box and presses the enter key. Firefox will use the above search engine description to construct the following search URL:
https://search.yahoo.com/search?p=mozilla&ei=UTF-8&fr=moz2
If the user clicks the magnifying glass icon in the search bar, or chooses the Web Search option in the Tools menu when the search bar isn't visible, the browser will take them to https://search.yahoo.com/, the value of the <SearchForm>
element.
Example: searching MDC
This plugin lets you easily search the Mozilla Developer Center web site.
<SearchPlugin xmlns="https://www.mozilla.org/2006/browser/search/"> <ShortName>MDC</ShortName> <Description>Mozilla Developer Center search</Description> <InputEncoding>UTF-8</InputEncoding> <Image width="16" height="16">data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAABGdBTUEAAK%2FINwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz%2F%2Fz8DJQAggJiQOe%2Ffv2fv7Oz8rays%2FN%2BVkfG%2FiYnJfyD%2F1%2BrVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw%2F8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi%2FG%2BQKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo%2BMXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia%2BCuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq%2FvLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg%2FkdypqCg4H8lUIACnQ%2FSOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD%2BaDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg%3D%3D</Image> <Url type="text/html" method="GET" template="https://developer.mozilla.org/en/docs/Special:Search?search={searchTerms}"/> <SearchForm>https://developer.mozilla.org/en/docs/Special:Search</SearchForm> </SearchPlugin>
Notice in this case that instead of using <Param>
to define parameters to the search engine, they're simply embedded inside the template URL. This is actually the preferred way to do things when using GET
as the method. <Param>
should be used for POST
.