Mycroft Project

Instructions for hosting Search Engine Plugins

This is a slightly modified version of the method used on the Mycroft Project.
There is further information at the Mozilla Developer Center.

Hotlinking to Mycroft

This is fine for Javascript installation as per the below example (please use external(os).php not install(os).php or update(os).php) However, please do not link directly to Mycroft when using the Autodiscovery capabilities of OpenSearch as it requests the OpenSearch description on each page load. Instead, host a copy of the xml description at http://example.com/opensearch.xml and use http://example.com/favicon.ico in the <image> tag. Plugins that abuse this will be removed.

Backend javascript

function addEngine(name, ext)
{
  if (window.sidebar && ("addSearchEngine" in window.sidebar)) {
    window.sidebar.addSearchEngine(
      "https://mycroftproject.com/external.php/" + name + ".src",
      "https://mycroftproject.com/external.php/" + name + "."+ ext, "", "");
  } else {
    alert("Your browser does not support Sherlock search plugins.");
  }
}

function addOpenSearch(name,ext,meth)
{
  if (window.external && ("AddSearchProvider" in window.external)) {
    // typeof weASP matches IE, wc matches Chrome, wnv matches Camino (bugs 430058/430067/430070)
    if (meth == "p" && ((window.chrome) || (typeof window.external.AddSearchProvider == "unknown") || (window.navigator.vendor == 'Camino'))) {
      alert("This plugin uses POST which is not supported by all implementations of OpenSearch.");
    } else {
      window.external.AddSearchProvider(
        "https://mycroftproject.com/externalos.php/" + name + ".xml");
    }
  } else {
    alert("Your browser does not support OpenSearch search plugins.");
  }
}

Installation links

<a href="#" onClick="addOpenSearch('mycroft','png','g');return false">Mycroft Project - All</a>
<a href="#" onClick="addEngine('mycroft','png');return false">Mycroft Project - Sherlock</a>

OpenSearch autodiscovery

<link rel="search" type="application/opensearchdescription+xml" title="Match ShortName" href="http://example.com/opensearch.xml">