google-chrome - Opensearch - 更改搜索引擎的名称
问题描述
我一直在尝试将 opensearch 支持添加到我的网站。这就是我所拥有的 opensearch.xml 文件:
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<script/>
<ShortName>Host</ShortName>
<Description>Search my Website</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">Favicon url</Image>
<Url type="application/x-suggestions+json" method="GET" template="http://suggestqueries.google.com/complete/search?output=firefox&q={searchTerms}" />
<Url type="text/html" method="GET" template="http://yoursite.com/?s={searchTerms}" />
<SearchForm>http://yoursite.com/</SearchForm>
</OpenSearchDescription>
但它正在将 URL 名称注册为 Chrome 设置中的搜索引擎名称以及按标签建议。我可以更改什么来识别具有不同名称的搜索引擎?
解决方案
首先,该脚本标签不应该在那里,所以你应该有这样的东西:
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Host</ShortName>
<Description>Search my Website</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">Favicon url</Image>
<Url type="application/x-suggestions+json" method="GET" template="http://suggestqueries.google.com/complete/search?output=firefox&q={searchTerms}" />
<Url type="text/html" method="GET" template="http://yoursite.com/?s={searchTerms}" />
<SearchForm>http://yoursite.com/</SearchForm>
</OpenSearchDescription>
那么,您是否尝试过更改页面中包含的链接元素的名称?
<link rel="search" href="/opensearchdescription.xml" type="application/opensearchdescription+xml" title="name" />
推荐阅读
- c# - 在 c# 中使用 SOAP Webservice,抛出未设置为对象实例的对象引用
- javascript - 无法使用 POSTMAN 发出 POST 请求 - “无法在只读编辑器中编辑。”
- c# - ASP.Net Core 身份重复用户
- ruby-on-rails - 试图让我的控制器每 60 秒连续触发一次。(导轨)
- java - @groupsequence 不适用于自定义验证?
- haskell - 如何在反射中将输入值设置为当天?
- php - 通过自定义文本更改 WooCommerce 产品可用性在库存文本中
- sql - 列 A 上的 SQL 内连接并比较列 B 中的值
- screenshot - 是否可以仅对带有应用程序的屏幕而不是我的所有 3 个屏幕进行失败的屏幕截图?
- r - R tibble:Col-1 与 Col2 为“ch2”的最后一行的差异