作为当今最差的浏览器,虽说IE行将推出历史的舞台,然而因为我的项目须要还是须要反对。那么必须判断是否是IE,如果是IE,须要做些非凡解决。

document.documentMode 是IE特有的属性,能够依据这个值判断是否为IE。如:

var isIE =  document.documentMode !== undefined;

的确是简略好用吧 :)

根本来说,document.documentMode的值就是IE的版本号,如:

  • 7 - The page is displayed in IE7 mode
  • 8 - The page is displayed in IE8 mode

    • 9 - The page is displayed in IE9 mode
    • 10 - The page is displayed in IE10 mode
    • 11 - The page is displayed in IE11 mode