173

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?

1
  • So, how to tell Chrome that my site is search enginge?
    – Abzac
    Commented Oct 3, 2011 at 0:43

3 Answers 3

219

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 XML Format Example

<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.

7
  • 10
    Note, that unlike Firefox, Chrome will discover your Open Search Description only if you put it on the root of your website.
    – varepsilon
    Commented Dec 2, 2014 at 9:08
  • 2
    is there a way to get that "omnibox-search" working with firefox?
    – JinSnow
    Commented Mar 10, 2015 at 7:21
  • How to find the url that leads directly to the query box on the target site? (in google translate for instance)
    – JinSnow
    Commented Nov 7, 2015 at 6:33
  • 2
    answer for google translate add this one to your search engine: translate.google.com/?source=osdd#auto|auto|%s
    – JinSnow
    Commented Nov 11, 2015 at 5:55
  • 1
    It looks like Chrome no longer adds tab-to-search automatically: 9to5google.com/2022/03/18/chrome-site-search-activate Commented Jan 30, 2023 at 23:01
37

Implementing omnibox support with search suggestions

The answer given by @element119 works perfect but here is a slightly tweaked code to support search suggestions as well as Mozilla Support.

Follow the steps below to implement omni box support for your site.

  1. Save the following code as search.xml
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
  <script/>
  <ShortName>Site Name</ShortName>
  <Description>Site Description (eg: Search sitename)</Description>
  <InputEncoding>UTF-8</InputEncoding>
  <Image width="16" height="16" type="image/x-icon">Favicon url</Image>
  <Url type="application/x-suggestions+json" method="GET" template="http://suggestqueries.google.com/complete/search?output=firefox&amp;q={searchTerms}" />
  <Url type="text/html" method="GET" template="http://yoursite.com/?s={searchTerms}" />
  <SearchForm>http://yoursite.com/</SearchForm>
</OpenSearchDescription>
  1. Upload search.xml to the root of your site.

  2. Add the following meta tag to your site's <head> tag

<link rel="search" href="http://www.yoursite.com/search.xml" type="application/opensearchdescription+xml" title="You site name"/>

Make sure to replace the domain urls with your domain.

1
  • 2
    Is it <SearchForm> or <moz:SearchForm>? I don't seems to find SearchForm in the OpenSearch docs and all other resources that I find online are using <moz:SearchForm>.
    – Niels R.
    Commented Sep 22, 2016 at 7:11
2

Google Chrome no longer supports the autodiscovery of site specific search

@googlechrome twitter account:
We made it so new Site search shortcuts are no longer automatically added to the Chrome search bar. We did this to help avoid cluttering it with Site search suggestions that people may not be using.

This response was originally provided in a comment (credit Olivier Lalonde) but I'm reposting it so it's easier to find (e.g. I didn't see this comment when I was originally looking for answers).

Not the answer you're looking for? Browse other questions tagged or ask your own question.