我一直在尝试向我的网站添加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>
但是它正在Chrome设置中以及在按标签建议时将URL名称注册为搜索引擎名称。我该如何更改以识别具有不同名称的搜索引擎?
答案 0 :(得分: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&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" />