meta标签有两个属性分别是http-equiv 属性和name 属性
A:>name属性 // 用于描述网页便于搜索引擎抓取
1、<meta name="keywords" content="关键词"> //告诉浏览器网页的关键词
2、<meta name="description" content="描述"> //告诉浏览器网页的描述
3、<meta name="viewport" content="width=device-width,initial-scale=1"> //常用于移动端网页 宽度等于设备宽度 缩放比例=1
4、<meta name="robots" content="none"> //搜索引擎爬行方式 默认all
参数:
① none 搜索引擎忽略此网页
② noindex 搜索引擎不索引此网页
③ nofollow 搜索引擎不继续通过此网页索引其他网页其他链接
④ all 搜索引擎索引此网页并索引此网页中的其他网页
⑤ index 搜索引擎索引此网页
⑥ follow 搜索引擎索引此网页中的其他网页链接
5、<meta name="author" content="admin@admin.com"> // 网页作者
6、<meta name="copyright" content="admin" > // 网页版权
7、<meta name="revisit-after" content="7 day"> //搜索引擎重访时间
8、<meta name="renderer" content="webkit"> //双核浏览器渲染方式
参数:webkit webkit内核 ie-comp IE兼容模式ie-stand IE标准模式
B:>http-equiv //http头文件 定义http参数
1、<meta http-equiv="content-Type" content="text/html;charset=utf-8"> // 设定网页字符集 旧方式
<meta charset="utf-8"> // HTML5方式 推荐
2、<meta http-equiv="X-UA-Compatible" content="IE-edge,chrome=1"> // 使用IE和chrome最高版本渲染当前页面
3、<meta http-equiv="cache-control" content="no-cache"> //指定请求和响应遵循的缓存机制
参数:
① no-cache 先发送请求与服务器端确认资源是否被更改 如果未被更改则使用缓存
② no-store 不允许缓存 每次都要去服务器上下载完整的响应
③ public 缓存所有响应 但并非必须 max-age也可以做到相同效果
④ private 只为单个用户缓存 不允许任何中继进行缓存 比如CND
⑤ max-age 表示当前请求开始 该响应能被多久内被缓存和重用而不去服务器重新请求 max-age=60
4、<meta http-equiv="expires" content="Sunday 26 October 2016 01:00 GMT" /> // 网页到期时间
5、<meta http-equiv="refresh" content="2;URL=http://www.baidu.com/"> // 自动刷新并跳转页面
6、<meta http-equiv="Set-Cookie" content="User=admin; path=/; expires=Sunday, 10-Jan-16 10:00:00 GMT"> // cookie 设定