浏览器版本类型及版本

在JS代码中输入console.log(navigator.userAgent)便可打印出以下navigator.userAgent

 

IE的userAgent 判断是否有MSIE

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)

 

Firefox的userAgent 

Mozilla/5.0 (Windows; U; Windows NT 5.2) Gecko/2008070208 Firefox/3.0.1

 

Opera的userAgent 判断是否有Opera

Opera/9.27 (Windows NT 5.2; U; zh-cn)

Mozilla/5.0 (Macintosh; PPC Mac OS X; U; en) Opera 8.0

 

 

Safari的userAgent 判断 AppleWebKit Version Mobile Safari

Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Version/3.1 Safari/525.13

Mozilla/5.0 (iPhone; U; CPU like Mac OS X) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3

 

Chrome的userAgent 判断是否有 AppleWebKit Chrome

Mozilla/5.0 (Windows; U; Windows NT 5.2) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13

 

posted @ 2017-02-04 15:05  云端漫步ruby  阅读(358)  评论(0编辑  收藏  举报