<meta>标签总结

1.Pragram:禁用浏览器缓存

<meta http-equiv="Pragma" content="no-cache">

2.expires:用于设定网页的到期时间,缓存

<meta http-equiv="expires" content="Fri, 12 Jan 2001 18:18:18 GMT">

前面两个缓存,当然缓存还有:cache-control策略、Last-Modifed/If-Modified-Since、Etag/If-None-Match(优先级高于last-modifed),注意F5和Ctrl+F5

3.经过一段时间转到另外某个页面

<meta http-equiv="refresh" content="0; url=">'

4.设定页面使用的字符集(常用)

<meta http-equiv="content-Type" content="text/html; charset=utf-8">

5.告诉搜索引擎你网页的关键字是什么

<meta name ="keywords" content="kingler,javascript,css,html">

6.告诉搜索引擎你的网站主要内容

<meta name="description" content="This is kingler's blog">

强制页面在当前窗口以独立页面显示,防止页面在其他iframe调用

<meta http-equiv="Window-target" content="_top">

7.显示语言

<meta http-equiv="Content-Language"content="zh-cn"/> 

8.目前项目中默认是网页设置为IE8的最高模式显示,省掉点击按钮设置,可添加meta标签

<meta http-equiv="X-UA-Compatible" content="IE=edge">

当然Js window.navigator下有很多属性是可以来判断浏览器类型,平台等等的。具体脑补。

而在IE下可以通过if(window.navigator.appName="Microsoft Internet Explorer"){

                            if(document.documentMode)

                          {     var ieversion=document.document.Mode;  

}                      

 }

来获取IE版本的;

当然涉及到一部分css或者js代码需要在不同版本中执行的话,可以通过条件注释的方式<!--[if lt/lte/gt/gte ie 8]><[endif]-->;

原文地址:https://www.cnblogs.com/zoujking/p/4185695.html