【发布时间】:2011-01-24 03:09:52
【问题描述】:
如果我开始在 Chrome 中输入 stackov.. 我可以看到类似 'Press Tab to search stackoverflow.com'。
SO 基本上被认为是搜索引擎。
您知道如何在我们的 WebApp 中实现相同的feature 吗?
我觉得应该和OpenSearch有关
<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="http://sstatic.net/so/opensearch.xml">
谢谢
编辑:
我认为应该只是指定一个以这种方式定义的 xml (http://sstatic.net/so/opensearch.xml)
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Stack Overflow</ShortName>
<Description>Search stackoverflow.com for answers to your programming questions</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">http://stackoverflow.com/favicon.ico</Image>
<Url type="text/html" method="get" template="http://stackoverflow.com/search?q={searchTerms}"></Url>
</OpenSearchDescription>
这是将要使用的 URL。
http://stackoverflow.com/search?q={searchTerms}
searchTerms 将填充您在 chrome 中输入的字符串
【问题讨论】:
-
当我阅读它时,它没有说“搜索 with stackoverflow”,它说搜索域 stackoverflow.com(使用 Chrome 使用的任何搜索引擎),如“site:stackoverflow.com 搜索词”。
-
我更喜欢这个关于“如何让谷歌浏览器检测站点搜索引擎?”的答案:stackoverflow.com/a/14082569/470749
标签: web-applications seo google-chrome search-engine opensearch