今天发现一个bug,用navigator.userAgent
检测ie浏览器,在edge浏览器仿真模式下,发现检测不了ie8-10;于是查看了360兼容模式
下和edge浏览器仿真模式
下各版本的navigator.userAgent
,对比如下:
//IE8
egde: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)
360兼容: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E)
//IE9
egde:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
360兼容:Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E)
//IE10
egde:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
360兼容:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E)
//IE11
egde:Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
360兼容:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E)
想问一下大神,有没有什么比较好的方法能够检测所有的ie8-10浏览器?谢谢!