Jonathan de M.
Jonathan de M.

Reputation: 9808

chrome omnibox how to add the search on domain

How one configure his web site to let users search only on his domain using omnibox?

Example:

I didn't find anyhing in the source code.

Upvotes: 6

Views: 909

Answers (2)

sheng
sheng

Reputation: 1372

Yes it's possible. I did this for my blog.

 <link rel="search" type="application/opensearchdescription+xml" title="The Sheng Blog" href="/resources/opensearch.php"/>

opensearch.php looks likes this:

 <?xml version="1.0"?>
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
     <ShortName>The Sheng Blog (Beta)</ShortName>
     <Description>The Sheng Blog Search</Description>
     <Developer>Sheng Slogar</Developer>
     <LongName>Search the entire Sheng Blog</LongName>
     <InputEncoding>UTF-8</InputEncoding>
     <OutputEncoding>UTF-8</OutputEncoding>
     <Query role="example" searchTerms="code"/>
     <SyndicationRight>open</SyndicationRight>
     <AdultContent>false</AdultContent>
     <Language>en-us</Language>
     <Contact>[email protected]</Contact>
     <Tags>code posts tutorials ideas playground</Tags>
     <Image width="16" height="16" type="image/x-icon">data:/ico;base64,AAABA...(Icon in base64)</Image>
     <Url type="text/html" template="http://theshengblogg.comule.com/search.php?s={searchTerms}"></Url>
     <Url type="application/x-suggestions+json" method="GET" template="http://theshengblogg.comule.com/autocomplete.php?search={searchTerms}&amp;json=true"/>
 </OpenSearchDescription>

I learned this from http://www.opensearch.org/Specifications/OpenSearch/1.1. The autocomplete part is optional. Return it in JSON format.

For example, if you search "a", return ["a","about","across","all","and"]. (Notice I put your query in the array as item 0.)

My autocomplete only seems to work in Firefox. This might be something with my sub domain. I also couldn't get it to work in IE or Chrome.

Upvotes: 2

Deveyus
Deveyus

Reputation: 43

http://dev.chromium.org/tab-to-search has the information on how to do it, potentially you could use a chrome addon to force the page to have the needed code for this to function, but I'm not sure how well such would work.

Upvotes: 2

Related Questions