Search code examples
internet-explorersearch-engine

Enable webpage for IE Search Provider


When we visit Stack Overflow, the IE Instant Search Dropdown button is turning orange indicating that SO can be added as a search provider.

What code should I put inside my web page for IE to detect that it's a compatible search web page?

Thank you!


Solution

  • You simply need to create an OpenSearch description document, and then include a link to it in your HTML header.

    The OpenSearch doco page shows this example of a description document:

    <?xml version="1.0" encoding="UTF-8"?>
     <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
       <ShortName>Web Search</ShortName>
       <Description>Use Example.com to search the Web.</Description>
       <Tags>example web</Tags>
       <Contact>[email protected]</Contact>
       <Url type="application/rss+xml" 
        template="http://example.com/?q={searchTerms}&amp;pw={startPage?}&amp;format=rss"/>
     </OpenSearchDescription>
    

    Then in your HTML header, include something like:

    <link rel="search"
           type="application/opensearchdescription+xml" 
           href="http://example.com/content-search.xml"
           title="Content search" />