win10自带edge浏览器 f12仿真模式下navigator.userAgent的bug怎么解决?

今天发现一个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浏览器?谢谢!

阅读 12.5k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
宣传栏