IE11 的appName和userAgent
IE11 的appName和userAgent 发生了变化,导致项目中之前对IE浏览器的判断失效,好伤心~~~
IE 10是最后一个appName叫做Microsoft Internet Explorer的网页浏览器了
IE 11 的userAgent 中竟然也不含有MSIE了
而IE之前各个版本典型的userAgent如下:
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 5.0; Windows NT)
IE连自己的本质都会改,不可思议~~~~~
IE11的user-agent: Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko
rMsie = /(msie\s|trident.*rv:)([\w.]+)/;
<SCRIPT language=javascript>
var userAgent = navigator.userAgent,
rMsie = /(msie\s|trident.*rv:)([\w.]+)/;
var browser;
var version;
var ua = userAgent.toLowerCase();
var match = rMsie.exec(ua);
if (match != null) {
alert("is ie");
} //判断是否是IE浏览器(涵盖IE11)