Flash, Mac and iPhone stuff
8 May
This post is for any web site owner who wants to add a search plugin for their site.
If your not too sure what I mean, then take a look in the top right corner of your browser next to the address bar, and you will see another input box. This allows you to search directly from the browser. If your using Firefox your default search in normally Google and for IE user its Live Search. There is a method to add your site so that users can find content without first having to go to your site. (take a look at flCodr.com to see this - simply click on the drop down box arrow and click ‘Add flCodr’).
The plugin takes the form of an XML file which holds some configuration settings such is icon, description and search parameters.
The XML file describing a search engine is actually quite simple, following the basic template below. Sections in bold need to be customized based on the needs of the specific search engine plugin you’re writing. Take a look below for more info. You can also find out more here.
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> <ShortName>engineName</ShortName> <Description>engineDescription</Description> <InputEncoding>inputEncoding</InputEncoding> <Image width="16" height="16">data:image/x-icon;base64,imageData</Image> <Url type="text/html" method="method" template="searchURL"> <Param name="paramName1" value="paramValue1"/> ... <Param name="paramNameN" value="paramValueN"/> </Url> <Url type="application/x-suggestions+json" template="suggestionURL"/> <moz:SearchForm>searchFormURL</moz:SearchForm> </OpenSearchDescription>
method attribute indicates whether to use a GET or POST request to fetch the result. The template attribute indicates the base URL for the search query. POST requests.type="text/html" is used to specify the URL for the actual search query itself.type="application/x-suggestions+json" is used to specify the URL to use for fetching search suggestions.{searchTerms} to substitute the search terms entered by the user in the search bar. Other supported dynamic search parameters are described in OpenSearch 1.1 parameters. {searchTerms} to insert the search terms entered by the user in the search bar. moz:” XML namespace prefix in the example above to ensure that other user agents that don’t support this element can safely ignore it.A web site that offers a search plugin can advertise it so that Firefox users can easily download and install the plugin.
To support autodiscovery, you simply need to add one line to the <head> section of your web page:
<link rel="search" type="application/opensearchdescription+xml" title="searchTitle" href="pluginURL">
Replace the italicized items as explained below:
Flash, Macs and Apps - thats pretty much what i'm about.
If you like what you see Digg my stories, and leave a comment. Thanks for looking
Leave a reply
You must be logged in to post a comment.