如何为 GAE 文档创建 Firefox 搜索插件?
这里的主要问题是搜索网址:
它不包含 ?
符号,也包含 #
符号。 此类 URL 未通过 XML 验证,因此我尝试了其他不同的方法(甚至包含附加参数),但尚未找到有效的解决方案。
这是我目前所拥有的(为了简化图像部分被截断):
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Google AppEngine</ShortName>
<Description>Search the GAE documents at Google Code website.</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,...</Image>
<Url type="text/html" method="GET" template="http://code.google.com/intl/it/query/#p=appengine">
<Param name="a" value="{moz:locale}"/>
<Param name="q" value="{searchTerms}"/>
</Url>
<moz:SearchForm>http://code.google.com/intl/it/appengine/docs/</moz:SearchForm>
</OpenSearchDescription>
The main problem here is with search url:
It doesn't contain ?
symbol, also it has #
symbol.
Such URL doesn't pass XML validation, so I've tried different other approaches (even inclusion of additional parameter), but haven't found working solution.
Here is what I have currently (image part is truncated for simplification):
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Google AppEngine</ShortName>
<Description>Search the GAE documents at Google Code website.</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,...</Image>
<Url type="text/html" method="GET" template="http://code.google.com/intl/it/query/#p=appengine">
<Param name="a" value="{moz:locale}"/>
<Param name="q" value="{searchTerms}"/>
</Url>
<moz:SearchForm>http://code.google.com/intl/it/appengine/docs/</moz:SearchForm>
</OpenSearchDescription>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用实体
&
对&
进行编码,XML将有效:将此XML复制到http://validator.w3.org/check 确认有效性。
Use entity
&
to encode the&
, and the XML will be valid:Copy this XML to http://validator.w3.org/check to confirm the validilty.