OpenSearch
An OpenSearch exampleHere is an implementation of an OpenSearch plugin for IE 7 and Firefox 2. I'm using my blogs search as the target search engine. Create the Description Document:OpenSearch Description Document <?xml version="1.0" encoding="utf-8" ?> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> <ShortName>Bruces Blog Search</ShortName> <Description>Search my Blog.</Description> <Tags>brucestockwell.net Blog Search</Tags> <Contact>bruce.stockwell@gmail.com</Contact> <Image width="16" height="16">data:image/x-icon;base64,R0lGODlhMAAwA...</Image> <!-- <Url type="application/atom+xml" template="http://www.brucestockwell.net/blog/?s={searchTerms}"/> --> <Url type="text/html" template="http://www.brucestockwell.net/blog/?s={searchTerms}"/> <!-- <moz:SearchForm>searchFormURL</moz:SearchForm> --> </OpenSearchDescription> You can encode your image for the search plugin here. The url elements template attribute will contain the full url path of the search with parameters added. A quick look at my browser address bar after a blog search for xml reveals: http://www.brucestockwell.net/blog/?s=xml xml is the search term. We simply remove the literal value and add add the parameter: http://www.brucestockwell.net/blog/?s={searchTerms} {searchTerms} will be replaced by the client when preparing the search url. Interesting note: What the Url element is doing is defining a search template. That could be any search template. I could have just as easily targeted my whole site via a google search like this: Alternate Search Engine <Url type="text/html" template="http://www.google.com/search?q=site:brucestockwell.net {searchTerms}"/> Add the Auto Discovery link to your page:OpenSearch link element <link rel="search" type="application/opensearchdescription+xml" title="Bruces Blog Search" href="http://brucestockwell.net/osd.xml" /> ResourcesCreated by: admin last modification: Monday 07 of April, 2008 [01:49:54 UTC] by admin |
Login
|