Creating MozSearch plugins

Firefox 2 uses a simplified form of the OpenSearch format for storing search plugins. A MozSearch seeks plugin is a file of XML that describes the search machine, his/her URL, and the parameters that need to be last to that URL.

Warning: MozSearch is without pattern and it is planned for internal use inside of Mozilla it projects only. It should only be used if he/she sweats intention will distribute the search plugin packed inside one Extension of Firefox, or if you are creating that plugins meant to be transported through lack in a construction of Firefox. For creating search plugins for installation of the web, see Creating OpenSearch plugins for Firefox

The plugin file

The format of MozSearch is similar for the OpenSearch format. The only difference is the root element and namespace of XML.

Example: seeking Yahoo!

Following XML is Firefox packed 2 search plugin for using to seek Yahoo!:

<SearchPlugin xmlns="http://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="http://ff.search.yahoo.com/gossip?output=fxjson&amp;command={searchTerms}" />
<Url type="text/html" method="GET" template="http://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>http://search.yahoo.com/</SearchForm>
</SearchPlugin>

The user say chooses to use Yahoo! seek machine plugin and he/she enters " in mozilla " in the search box and presses the he/she enters in key. Firefox will use the previous description of search machine to build URL of following search:

http://search.yahoo.com/search?p=mozilla&ei=UTF-8&fr=moz2

If the user clicks the magnifying glass icon in the search bar, or he chooses the Web Seeks option in the menu of Tools when the search bar is not visible, the browser will take them <tt>http://search.yahoo.com/</tt>, the value of the <SearchForm> element.

Example: Looking MDC

This plugin lets to seek him/it easily Promoting Mozilla Center local web.

<SearchPlugin xmlns="http://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="http://developer.mozilla.org/en/docs/Special:Search?search={searchTerms}"/>
<SearchForm>http://developer.mozilla.org/en/docs/Special:Search</SearchForm> 
</SearchPlugin>

Notice in this case that instead of using <Param> to define parameters to the search machine, they are simply embedded inside of model URL. This is in fact the favorite way to do things when using GET as the method. <Param> it should be used for POST.

Also see

 

Document Tags and Contributors

Last updated by: portaldobarulho,