跳至正文
Wener Notes

OpenSearch

约 1 分钟阅读
标签:规范搜索

Template

OpenSearchDescription.xml:

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>engineName</ShortName>
  <Description>engineDescription</Description>
  <InputEncoding>inputEncoding</InputEncoding>
  <Image width="16" height="16" type="image/x-icon">data:image/x-icon;base64,imageData</Image>
  <Url type="text/html" method="method" template="searchURL">
    <Param name="paramName1" value="paramValue1"/>
    <Param name="paramNameN" value="paramValueN"/>
  </Url>
  <Url type="application/x-suggestions+json" template="suggestionURL"/>
  <moz:SearchForm>searchFormURL</moz:SearchForm>
</OpenSearchDescription>

Auto Discovery

Add <link> to head:

html
<link
  rel="search"
  type="application/opensearchdescription+xml"
  title="MySite: By Author"
  href="http://www.mysite.com/mysiteauthor.xml"
/>
<link
  rel="search"
  type="application/opensearchdescription+xml"
  title="MySite: By Title"
  href="http://www.mysite.com/mysitetitle.xml"
/>

关联信息

反向链接、本文链接的其他页面和外部资料。

参考资料

其他外链1 条
最近更新commit 906e816编辑