如何为您的网站添加 google chrome 多功能框搜索支持?
当我在 Google Chrome 多功能框中输入某些 URL 时,我会看到其中的消息“按 TAB 键在 $URL 中搜索”。例如,有一些俄罗斯网站 habrahabr.ru 或 yandex.ru。当您按 TAB 时,您将能够在该网站中进行搜索,而不是在搜索引擎中进行搜索。 如何让我的网站能够做到这一点?也许,我需要在我的网站页面中编写一些特殊的代码?
When I enter some of URLs in Google Chrome omnibox, I see message in it "Press TAB to search in $URL". For example, there are some russian sites habrahabr.ru or yandex.ru. When you press TAB you'll be able to search in that site, not in your search engine.
How to make my site to be able for it? Maybe, I need to write some special code in my site pages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Chrome 通常通过用户偏好来处理此问题。 (通过
chrome://settings/searchEngines
)但是,如果您想专门为您的用户实现此功能,则需要向您的网站添加 OSD(开放搜索描述)。
使用 Google Chrome 的 OmniBox [TAB ] 个人网站的功能?
然后,您将此 XML 文件添加到您网站的根目录,并在您的
标记中链接到它:
现在,您的访问者页面会自动将您网站的搜索信息放入 Chrome 的内部设置 (
chrome://settings/searchEngines
)。OpenSearchDescription XML 格式示例
重要的部分是
项。{searchTerms}
将替换为用户在多功能栏中搜索的内容。以下是 OpenSearch 的链接,了解更多信息。
Chrome usually handles this through user preferences. (via
chrome://settings/searchEngines
)However, if you'd like to implement this specifically for your users, you need to add a OSD (Open Search Description) to your site.
Making usage of Google Chrome's OmniBox [TAB] Feature for/on personal website?
You then add this XML file to the root of your site, and link to it in your
<head>
tag:Now, visitors to your page will automatically have your site's search information placed into Chrome's internal settings at
chrome://settings/searchEngines
.OpenSearchDescription XML Format Example
The important part is the
<url>
item.{searchTerms}
will be replaced with what the user searches for in the omnibar.Here's a link to OpenSearch for more information.
通过搜索建议实现多功能框支持
@element119 给出的答案非常完美,但这里有一个稍微调整的代码以支持搜索建议以及 Mozilla 支持。
请按照以下步骤为您的网站实施多功能框支持。
将 search.xml 上传到网站的根目录。
将以下元标记添加到您网站的
标记
确保将域名网址替换为您的域名。
Implementing omnibox support with search suggestions
The answer given by @element119 works perfect but here is a slightly tweaked code to support search suggestions as well as Mozilla Support.
Follow the steps below to implement omni box support for your site.
Upload search.xml to the root of your site.
Add the following meta tag to your site's
<head>
tagMake sure to replace the domain urls with your domain.
Google Chrome 不再支持自动发现网站特定搜索
此回复最初是提供的在评论中(信用 Olivier Lalonde),但我重新发布它,以便更容易找到(例如,当我最初是在寻找答案)。
Google Chrome no longer supports the autodiscovery of site specific search
This response was originally provided in a comment (credit Olivier Lalonde) but I'm reposting it so it's easier to find (e.g. I didn't see this comment when I was originally looking for answers).