Adding search engines from web pages

  • Revision slug: Adding_search_engines_from_web_pages
  • Revision title: Adding search engines from web pages
  • Revision id: 93128
  • Created:
  • Creator: GavinSharp
  • Is current revision? No
  • Comment /* Installing OpenSearch and MozSearch plugins */

Revision Content

Firefox allows JavaScript code to install search engine plugins, and supports three search engine plugin formats: OpenSearch, MozSearch, and Sherlock.

When JavaScript code attempts to install a search plugin, Firefox presents an alert asking the user for permission to install the plugin.

Installing OpenSearch and MozSearch plugins

To install either an OpenSearch or a MozSearch plugin, you need to use the window.sidebar.AddSearchProvider() DOM method. The syntax for this method is:

window.external.AddSearchProvider(engineURL)

Where engineURL is the URL to the XML file for the search engine plugin.

Note: OpenSearch and MozSearch support is available only in Firefox 2 and later.

For details on MozSearch, see Creating MozSearch plugins.

For details on OpenSearch, see OpenSearch support in Firefox.

Installing Sherlock plugins

To install a Sherlock plugin, you need to call window.sidebar.addSearchEngine(), the syntax for which is:

window.sidebar.addSearchEngine(engineURL, iconURL, suggestedName, suggestedCategory)

The engineURL parameter is the URL to the Sherlock plugin (a ".src" file) to install. iconURL is the URL to an icon to associate with the plugin. The suggestedName parameter is only used when prompting the user for permission to install the plugin, so that a message such as "Do you want to install suggestedName from engineURL?" can be displayed.

Note: The suggestedCategory parameter is not used. You should specify either an empty string ("") or null.

For details on Sherlock, visit http://developer.apple.com/macosx/sherlock/

Revision Source

<p>Firefox allows JavaScript code to install search engine plugins, and supports three search engine plugin formats: OpenSearch, MozSearch, and Sherlock.
</p><p>When JavaScript code attempts to install a search plugin, Firefox presents an alert asking the user for permission to install the plugin.
</p>
<h2 name="Installing_OpenSearch_and_MozSearch_plugins">Installing OpenSearch and MozSearch plugins</h2>
<p>To install either an OpenSearch or a MozSearch plugin, you need to use the <code>window.sidebar.AddSearchProvider()</code> DOM method.  The syntax for this method is:
</p>
<pre class="eval">window.external.AddSearchProvider(<i>engineURL</i>)
</pre>
<p>Where <i>engineURL</i> is the URL to the XML file for the search engine plugin.
</p>
<div class="note"><b>Note:</b> OpenSearch and MozSearch support is available only in Firefox 2 and later.</div>
<p>For details on MozSearch, see <a href="en/Creating_MozSearch_plugins">Creating MozSearch plugins</a>.
</p><p>For details on OpenSearch, see <a href="en/OpenSearch_support_in_Firefox">OpenSearch support in Firefox</a>.
</p>
<h2 name="Installing_Sherlock_plugins">Installing Sherlock plugins</h2>
<p>To install a Sherlock plugin, you need to call <code>window.sidebar.addSearchEngine()</code>, the syntax for which is:
</p>
<pre class="eval">window.sidebar.addSearchEngine(<i>engineURL</i>, <i>iconURL</i>, <i>suggestedName</i>, <i>suggestedCategory</i>)
</pre>
<p>The <i>engineURL</i> parameter is the URL to the Sherlock plugin (a ".src" file) to install.  <i>iconURL</i> is the URL to an icon to associate with the plugin.  The <i>suggestedName</i> parameter is only used when prompting the user for permission to install the plugin, so that a message such as "Do you want to install <i>suggestedName</i> from <i>engineURL</i>?" can be displayed.
</p>
<div class="note"><b>Note:</b> The <i>suggestedCategory</i> parameter is not used.  You should specify either an empty string ("") or null.</div>
<p>For details on Sherlock, visit http://developer.apple.com/macosx/sherlock/
</p>
Revert to this revision