开发者

Enable webpage for IE Search Provider

When we visit Stack Overflow, the开发者_JAVA技巧 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!


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>admin@example.com</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" />


Example taken right from the SO source:

<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="http://sstatic.net/so/opensearch.xml">

Read more here: http://www.opensearch.org/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜