6

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

Example:

  • type youtube.com then press tab enter image description here
  • or type yahoo.com then press enter image description here
  • trying with vimeo wouldn't work

I didn't find anyhing in the source code.

Jonathan de M.
  • 9,721
  • 8
  • 47
  • 72

2 Answers2

2

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.

Deveyus
  • 43
  • 1
  • 6
2

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>contact@theshengblogg.comule.com</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.

sheng
  • 1,226
  • 8
  • 17