Ano*_*tor 2 search google-chrome
当我编写“ stackoverflow.com”或“ bing.com”,然后在Google Chrome浏览器URL中添加空格时,它会添加“搜索stackoverflow”或“搜索bing”。
那么,我们需要在我们的Web应用程序中实现什么才能使Google chrome做到这一点?
注意:我发现stackoverflow和bing作为添加的搜索引擎。我还没有添加。因此必须是一种要求从Web应用程序将其添加为搜索引擎的方法。
您将需要为您的网站创建opensearch xml文档,然后再link通过page创建head。
示例,这是为stackoverflow设计的方式:
<head>
<link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="/opensearch.xml">
</head>
Run Code Online (Sandbox Code Playgroud)
** 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>
Run Code Online (Sandbox Code Playgroud)
您可以在Youtube,Github等热门搜索存储库中查看更多示例。另请参阅此铬选项卡式搜索项目以获取更多详细信息。