When I enter some of URLs in Google Chrome omnibox, I see message in it "Press TAB to search in $URL". For example, there are some russian sites habrahabr.ru or yandex.ru. When you press TAB you'll be able to search in that site, not in your search engine. How to make my site to be able for it? Maybe, I need to write some special code in my site pages?
Chrome usually handles this through user preferences. (via chrome://settings/searchEngines
)
However, if you'd like to implement this specifically for your users, you need to add a OSD (Open Search Description) to your site.
Making usage of Google Chrome's OmniBox [TAB] Feature for/on personal website?
You then add this XML file to the root of your site, and link to it in your <head>
tag:
<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml" />
Now, visitors to your page will automatically have your site's search information placed into Chrome's internal settings at chrome://settings/searchEngines
.
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Your website name (shorter = better)</ShortName>
<Description>
Description about your website search here
</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">your site favicon</Image>
<Url type="text/html" method="get" template="http://www.yoursite.com/search/?query={searchTerms}"/>
</OpenSearchDescription>
The important part is the <url>
item. {searchTerms}
will be replaced with what the user searches for in the omnibar.
Here's a link to OpenSearch for more information.