Revision 93142 of Adding search engines from web pages

  • Revision slug: Adding_search_engines_from_web_pages
  • Revision title: Adding search engines from web pages
  • Revision id: 93142
  • Created:
  • Creator: GavinSharp
  • Is current revision? No
  • Comment

Revision Content

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

Note: Starting with Firefox 2, OpenSearch is the preferred search format for Firefox.

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

Installing OpenSearch plugins

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

window.external.AddSearchProvider(engineURL);

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

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

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.
  • 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/

{{ wiki.languages( { "ca": "ca/Addici\u00f3_de_motors_de_cerca_a_les_p\u00e0gines_web", "fr": "fr/Ajout_de_moteurs_de_recherche_depuis_des_pages_Web", "it": "it/Installare_plugin_di_ricerca_dalle_pagine_web", "ja": "ja/Adding_search_engines_from_web_pages" } ) }}

Revision Source

<p>Firefox allows JavaScript code to install search engine plugins, and supports two search engine plugin formats: <a href="en/Creating_OpenSearch_plugins_for_Firefox">OpenSearch</a>, and Sherlock.
</p>
<div class="note"><b>Note:</b> Starting with Firefox 2, OpenSearch is the preferred search format for Firefox.</div>
<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_plugins">Installing OpenSearch plugins</h2>
<p>To install an OpenSearch plugin, you need to use the <code>window.external.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 absolute URL to the XML file for the search engine plugin.
</p>
<div class="note"><b>Note:</b> OpenSearch support is available only in Firefox 2 and later.</div>
<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>
<ul><li> The <code>engineURL</code> parameter is the URL to the Sherlock plugin (a ".src" file) to install.
</li><li> <code>iconURL</code> is the URL to an icon to associate with the plugin.
</li><li> The <code>suggestedName</code> 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.
</li><li> The <code>suggestedCategory</code> parameter is not used.  You should specify either an empty string (<code>""</code>) or <code>null</code>.
</li></ul>
<p>For details on Sherlock, visit http://developer.apple.com/macosx/sherlock/
</p>{{ wiki.languages( { "ca": "ca/Addici\u00f3_de_motors_de_cerca_a_les_p\u00e0gines_web", "fr": "fr/Ajout_de_moteurs_de_recherche_depuis_des_pages_Web", "it": "it/Installare_plugin_di_ricerca_dalle_pagine_web", "ja": "ja/Adding_search_engines_from_web_pages" } ) }}
Revert to this revision