【问题标题】:How to Search Website From Address Bar如何从地址栏搜索网站
【发布时间】:2018-06-15 05:18:12
【问题描述】:

当我写“stackoverflow.com”或“bing.com”然后在 google chrome URL 中添加空格时,它会添加“search stackoverflow”或“search bing”。

那么我们需要在我们的网络应用中实现什么来让谷歌浏览器做到这一点?

注意:我发现 stackoverflow 和 bing 作为搜索引擎添加。我没有添加它。所以必须是一种要求将其添加为网络应用程序的搜索引擎的方法。

【问题讨论】:

    标签: google-chrome search


    【解决方案1】:

    您需要为您的网站创建 opensearch xml 文档,然后通过您的页面 headlink

    例如,这是为 stackoverflow 设计的:

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

    **OpenSearch xml **

    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
        <script/>
        <ShortName>Stack Overflow</ShortName>
        <Description>
    Search Stack Overflow: Q&A for professional and enthusiast programmers
        </Description>
        <InputEncoding>UTF-8</InputEncoding>
        <Image width="16" height="16" type="image/x-icon">
    https://cdn.sstatic.net/Sites/stackoverflow/img/favicon.ico?v=4f32ecc8f43d
        </Image>
        <Url type="text/html" method="get" template="http://stackoverflow.com/search?q={searchTerms}"/>
    </OpenSearchDescription>
    

    您可以通过 Youtube、Github 等热门搜索存储库查看更多示例。 另请参阅此chromium tab-to-search 项目以了解更多详细信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-24
      • 1970-01-01
      • 2018-12-20
      • 2018-07-31
      • 1970-01-01
      • 2015-01-29
      • 1970-01-01
      相关资源
      最近更新 更多