星空网 > 软件开发 > 网页设计

一种判断浏览器版本的方法

一种判断浏览器版本的方法

主要通过ie浏览器的条件注释来实现

<!DOCTYPE html><!--[if IE 6]><html lang="zh-cmn-Hans"><![endif]--><!--[if IE 7]><html lang="zh-cmn-Hans"><![endif]--><!--[if IE 8]><html lang="zh-cmn-Hans"><![endif]--><!--[if IE 9]><html lang="zh-cmn-Hans"><![endif]--><!--[if !IE]><!--><html lang="zh-cmn-Hans"><script>  if (window.navigator.userAgent.toLowerCase().indexOf("firefox") >= 0) {    document.documentElement.className += ' firefox';  } else if (window.navigator.userAgent.toUpperCase().indexOf("chrome") >= 0) {    document.documentElement.className += ' chrome';  } else {    if (/*@cc_on!@*/false) {//ie10      document.documentElement.className += ' ie10';    }    if (document.documentMode) {      if (/*@cc_on!@*/true) {//ie11        document.documentElement.className += ' ie' + document.documentMode;      }    }  }</script><!--<![endif]-->

 

 

然后css就可以这么写

.ie6 body{  /*ie6 hack*/}.ie7 body{   /*ie7 hack*/}

  




原标题:一种判断浏览器版本的方法

关键词:浏览器

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

上新一天就破万?!日均出单200+,亚马逊大卖如何从1到N走向全球?:https://www.ikjzd.com/articles/121753
毛衣战为啥结束了:https://www.ikjzd.com/articles/12177
亚马逊新手卖家都会遇到的问题,答案全在这!:https://www.ikjzd.com/articles/121775
亚马逊将从夏季开始标准化服装产品尺寸:https://www.ikjzd.com/articles/121776
2020年亚马逊第一季度财务报表公布,收入翻倍创四年来新高!:https://www.ikjzd.com/articles/121777
2020年做跨境电商亚马逊铺货的技巧分享:https://www.ikjzd.com/articles/121781
昆明旅游索道公司 昆明旅游索道公司有哪些:https://www.vstour.cn/a/406243.html
太仓美食网(探寻太仓最美味的美食):https://www.vstour.cn/a/406244.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流