Opensearch - 更改搜索引擎的名称

Yas*_*dra 5 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&amp;q={searchTerms}" />
  <Url type="text/html" method="GET" template="http://yoursite.com/?s={searchTerms}" />
  <SearchForm>http://yoursite.com/</SearchForm>
</OpenSearchDescription>
Run Code Online (Sandbox Code Playgroud)

但它在Chrome设置中以及按下标签提示时将网址名称注册为搜索引擎名称.我可以更改哪些内容以识别具有不同名称的搜索引擎?

小智 0

首先,脚本标签不应该在那里,所以你应该有这样的东西:

 <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&amp;q={searchTerms}" />
  <Url type="text/html" method="GET" template="http://yoursite.com/?s={searchTerms}" />
  <SearchForm>http://yoursite.com/</SearchForm>
</OpenSearchDescription>
Run Code Online (Sandbox Code Playgroud)

然后,您是否尝试过更改页面中包含的链接元素的名称?

<link rel="search" href="/opensearchdescription.xml" type="application/opensearchdescription+xml" title="name" />
Run Code Online (Sandbox Code Playgroud)