Chrome has a feature where you can enter a domain name in the address bar and press the Tab key to enter a search. This makes it easy to search for a site’s content.
This feature is called Tab to Search. Of course, not every site supports it, as the search interface varies from site to site. However, this feature is not an adaptation of Chrome for well-known sites, but is implemented through an open standard OpenSearch description format . As long as your site conforms to this specification, it will support Tab to Search.
It is very simple to implement. First, add a link to an OpenSearch description in the <head>
tag on the home page of your site.
Then create an OpenSearch description. In this example we need to create an opensearch.xml
in the root of the site .
The <Url>
tag specifies the template for the search link, and {searchTerms}
indicates the keywords to search for. The OpenSearch description also supports additional configuration fields, the format of which is described in its documentation. But for Tab to Search, this is enough.
My blog is a static site, and the search is purely front-end. So I have to do some processing to read the search field of the URL.
Done! The result looks like this: