今天总结下Meta标签用法用途:
<!DOCTYPE html> H5标准声明,使用 HTML5 doctype,不区分大小写
<head lang=″en″> 标准的 lang 属性写法
<meta charset=″utf-8″> 声明文档使用的字符编码
<meta http-equiv=″X-UA-Compatible″ content=″IE=edge,chrome=1″> 优先使用 IE 最新版本和 Chrome
<meta name=″description″ content=″不超过150个字符″> 页面描述
<meta name=”keywords” content=””> 页面关键词
<meta name=”author” content=”name, email@gmail.com”> 网页作者
<meta name=”robots” content=”index,follow”> 搜索引擎抓取
<meta name=”viewport” content=”initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no”> 为移动设备添加 viewport
<meta name=”apple-mobile-web-app-title” content=”标题”> iOS 设备 begin
<meta name=”apple-mobile-web-app-capable” content=”yes”> 添加到主屏后的标题(iOS 6 新增)
是否启用 WebApp 全屏模式,删除苹果默认的工具栏和菜单栏
<meta name=”apple-itunes-app” content=”app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL”>
添加智能 App 广告条 Smart App Banner(iOS 6+ Safari)
<meta name=”apple-mobile-web-app-status-bar-style” content=”black”>
<meta name=”format-detection” content=”telphone=no, email=no”> 设置苹果工具栏颜色
<meta name=”renderer” content=”webkit”> 启用360浏览器的极速模式(webkit)
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”> 避免IE使用兼容模式
<meta http-equiv=”Cache-Control” content=”no-siteapp” > 不让百度转码
<meta name=”HandheldFriendly” content=”true”> 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓
<meta name=”MobileOptimized” content=”320″> 微软的老式浏览器
<meta name=”screen-orientation” content=”portrait”> uc强制竖屏
<meta name=”x5-orientation” content=”portrait”> QQ强制竖屏
<meta name=”full-screen” content=”yes”> UC强制全
<meta name=”x5-fullscreen” content=”true”> QQ强制全屏
<meta name=”browsermode” content=”application”> UC应用模式
<meta name=”x5-page-mode” content=”app”> QQ应用模式
<meta name=”msapplication-tap-highlight” content=”no”> windows phone 点击无高光
设置页面不缓存
<meta http-equiv=”pragma” content=”no-cache”>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”expires” content=”0″>
看完后是不是有种万万没想到的感觉,区区一个Meta标签居然就有如此多种应用。小编也是这种感觉,为了不暴露前端知识不足的问题,这篇我已经收藏了。
meta站点字符编码:<meta charset=’utf-8′>
meta禁止浏览器缓存:<meta http-equiv=”Pragma” contect=”no-cache” />
meta站点描述:<meta name=”description” content=”不超过150个字符” />
meta站点关键字:<meta name=”keywords” content=”不超过200个字符” />
https://www.zhihu.com/question/27565755
html页面如何真正彻底的禁止缓存呢?
在开发中经常有需求需要禁止HTML的缓存,如网上所说在head标签里加入如下代码:
<META HTTP-EQUIV=”Pragma” CONTENT=”no-cache”>
<META HTTP-EQUIV=”Cache-Control” CONTENT=”no-cache”>
<META HTTP-EQUIV=”Expires” CONTENT=”0″>
但是实际使用中却发现即使这样设置了,却还是在首次加载时仍然是旧的页面,再次刷新才能更新到最新的。这样往往就达不想要的效果。请问有没有真正彻底的方法呢?
====================================================================
<meta http-equiv=”pragram” content=”no-cache”>
禁止浏览器从本地缓存中调阅页面。
网页不保存在缓存中,每次访问都刷新页面。
<meta http-equiv=”cache-control” content=”no-cache, must-revalidate”>
同上面意思差不多,必须重新加载页面
<meta http-equiv=”expires” content=”0″>
网页在缓存中的过期时间为0,一旦网页过期,必须从服务器上重新订阅。
禁止页面缓存的几种方法:http://blog.csdn.net/binggoogle/article/details/50388026
近期评论