Categories
ASP.NET HTML Search Engine Optimization

How to enable press tab to search in Google Chrome and Mozilla Firefox on your website

Today, I learned something new while using StackOverflow in google chrome that it provides special area in browser’s address bar to search on the site even before you visit the site. I think this is very good feature as user can find the things very quickly on your site and get the expected output as soon as possible without having to see unnecessary details.

In image below you can see that I have enabled it for this site, it is visible in browser’s address bar and just below it you can compare it with the StackOverflow’s search in address bar.

Open Search on www.harshbaid.in
Open Search on www.harshbaid.in

 

Open Search on www.stackoverflow.com
Open Search on www.stackoverflow.com

You must be thinking that how to enable this for your own site or any other site that you are implementing, that is very easy task. You need to add OpenSearch XML on your site and link the OpenSearch XML document in html head section.

Example Usage

opensearch.xml

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
    Example.com
    Example.com Search
    Search through Example.com

    UTF-8
    UTF-8
    false
    en-us
    open
    Example.com
    tag1,tag2

http://example.com/favicon.ico

Html link

Place the below html code inside <head> element section of the site.

opensearchdescription+xml" title="Example.com" href="http://www.example.com/opensearch.xml">

What is OpenSearch ?

And OpenSearch document consists of:

  1. OpenSearch Description files: XML files that identify and describe a search engine.
  2. OpenSearch Query Syntax: describe where to retrieve the search results
  3. OpenSearch RSS (in OpenSearch 1.0) or OpenSearch Response (in OpenSearch 1.1): format for providing open search results.
  4. OpenSearch Aggregators: Sites that can display OpenSearch results.
  5. OpenSearch “Auto-discovery” to signal the presence of a search plugin link to the user and the link embedded in the header of HTML pages

Find more about opensearch

Referenced From Stackoverflow

Enable pressing tab to search in google chrome on my website