html - link标签rel属性为search是怎么使用的?
本文介绍了html - link标签rel属性为search是怎么使用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
查看网站源码的时候看到rel属性值为search的link标签,网上搜索的结果大多是一句链接到文档的搜索工具,不是很明白这里的用法,请问如此写是有什么作用么?
解决方案
通过rel="search",把你的搜索功能放到浏览器的快捷搜索工具上
用firefox打开taobao时,看一下地址栏边上的快捷搜索时,可以填加一个淘宝搜索,完成后,以后就可以直接在那里搜索东西了!
实现方法:
在首页的head标签里加上 <link rel="search" type="application/opensearchdescription+xml" href=provider.xml" title="关键词搜索" />
provider.xml的写法为:
<?xml version="1.0" encoding="utf-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<InputEncoding>UTF-8</InputEncoding>
<ShortName>关键词搜索</ShortName>
<Description>关键词搜索</Description>
<Image height="16" width="16" type="image/vnd.microsoft.icon">images/favicon.ico</Image>
<Url type="text/html" template="search.PHP?keyword={searchTerms}" />
</OpenSearchDescription>
这篇关于html - link标签rel属性为search是怎么使用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文