当前位置:首页 > 前端

实现 OpenSearch(Tab to Search)功能

Z先生10年前 (2016-06-28)前端6891

在网站上添加了 OpenSearch 功能以后,IE 7.0 和 Firefox 2.0 以上的浏览器就能够在自带的搜索栏里面添加这个网站的搜索功能了。


第一:原始网站支持GET传递参数搜索:


第二:编写 OpenSearch 描述文件:

<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
  <ShortName>Web Search</ShortName>
  <Description>Use Example.com to search the Web.</Description>
  <Tags>example web</Tags>
  <Contact>admin@example.com</Contact>
  <Url type="text/html" template="http://example.com/?q={searchTerms}"/>
</OpenSearchDescription>


第三:添加对 OpenSearch 描述文件的引用:

在网站的模板的 <head> 标记中添加一句:

<link type="application/opensearchdescription+xml" href="opensearch.xml" title="Web Search" rel="search" />


分享给朋友:

相关文章

小程序二维码传参处理&UNIAPP H5传参兼容处理

首先小程序生成二维码,我这里调用的接口是:getUnlimited,我传递的参数是:invite=10001接着就是小程序中处理,如果直接扫二维码在App.vue的onLaunch中,使用decode…

去掉H5中number输入框的上下箭头

方法一:CSS样式处理input::-webkit-outer-spin-button, input::-webkit-inner-spin-button{    &…

ColorUI色系

ColorUI色系

                          …

MUMU模拟器调试APP注意事项

MUMU模拟器默认ADB端口7555,所以要么修改MUMU默认端口,要么修改IDE编辑器链接端口为7555。做好这个MARK!…

写给即将寿终正寝的Flash,即html5 Flash解决方案

写给即将寿终正寝的Flash,即html5 Flash解决方案

Adobe的Flash将于2020年12月31日正式终止。Adobe公司最近宣布,将会正式宣布停止对Flash的支持,这也变相宣布了Flash的死亡,Flash Player将于2020年12月31日…

js获取指定文件的路径

获取指定js文件的路径var src = '/static/js/demo.js'; var path = src.sub…

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。