0

我在Firefox搜索栏中添加了自定义搜索引擎。当我进入那里时,例如“我是谁?” 它作为"Who+am+It%253F"而不是预期的"Who+am+It%3F"传递给自定义搜索引擎。结果是搜索引擎返回空结果集。

它在例如 Chrome 上运行良好。

还在同一个Firefox中尝试了其他一些 OpenSearch 搜索引擎,例如 Wikipedia 或 DuckDuckGo,它们工作得很好。

您知道问题的根源是什么吗?

看起来 searchTerms 被编码了两次或类似的东西。

这是使用的 XML

<?xml version="1.0"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
    <ShortName>ShortName</ShortName>
    <LongName>LongName</LongName>
    <Description>Description</Description>
    <Tags>discussions friends articles</Tags>
    <Contact>admin@domain.com</Contact>
    <Url type="text/html" method="get" template="URL?param=value&amp;query={searchTerms}"/>
    <Image height="16" width="16" type="image/x-icon">URL/favicon.ico</Image> 
    <Image height="64" width="64" type="image/png">URL/nikoscope64.png</Image> 
    <Query role="example" searchTerms="st" />
  <AdultContent>false</AdultContent>
  <Language>en-us</Language>
  <InputEncoding>UTF-8</InputEncoding>
  <OutputEncoding>UTF-8</OutputEncoding>
</OpenSearchDescription>
4

1 回答 1

0

问题的根源似乎是 Url.template 指向使用HTTP协议的结果页面,即使服务器运行在HTTPS协议上。

更改此部分:

<Url type="text/html" method="get" template="http://SOME_DOMAIN?param=value&amp;query={searchTerms}"/>

进入

<Url type="text/html" method="get" template="https://SOME_DOMAIN?param=value&amp;query={searchTerms}"/>

解决了这个问题。请注意,清空浏览器缓存不足以获取新版本的 OpenSearch XML。需要删除并重新添加搜索引擎

于 2016-05-18T11:59:41.403 回答