Search code examples
javascriptgoogle-chromesearchgoogle-apigoogle-search

Chrome Smart Site Search


I noticed that a couple of sites have a built in Chrome search feature. If I type stackoverflow.com and then press space in the address bar I get: Chrome site search




Which takes me to this: SO search

How is this done, the major sites like Stackoverflow and github have this feature, but sites that don't implement this default to a regular google search


Solution

  • This line, which is in the HTML of every Stack Overflow page, is responsible:

    <link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">
    

    The format of that XML file is documented here:

    http://www.opensearch.org/Specifications/OpenSearch/1.1