用$.support.leadingWhitespace检查浏览器是否为IE6-8

515 阅读1分钟
  • .support.leadingWhitespace为IE中特有的属性,因此可以利用.supprot.leadingWhitespace来判断浏览器是否是IE6-8.
    var ieFlag=  $.support.leadingWhitespace;//定义判断IE8的变量
      if(!ieFlag){//IE8以下
         //IE代码
      }else{
         //其他代码
      }
  • 如果用户需要支持 IE 6/7/8,只能使用 jQuery 1.9。 如果要全面支持 IE,并混合使用 jQuery 1.9 和 2.0
<!--[if lt IE 9]>
     <script src='jquery-1.9.0.js'></script>
<![endif]-->
<!--[if gte IE 9]>
     <script src='jquery-2.0.0.js'></script>
<![endif]-->