浏览器的简单识别
机子上的几个浏览器:
浏览器名称
navigator.userAgent
appName
firefox
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0
Netscape
ie7 Mozilla/4.0
(compatible; MSIE 7.0; Windows NT 6.1; WOW64; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Microsoft Internet Explorer
ie8
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E)
Microsoft Internet Explorer
ie9
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Microsoft Internet Explorer
ie11
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; rv:11.0) like Gecko
Netscape
chrome
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36
Netscape
opera
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36 OPR/28.0.1750.48 (Edition Baidu)
Netscape
safari
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Netscape
<script type="text/javascript"> var sys = new Object(); var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf('opera')>=0){/* opera的判断必须在chrome之前*/ sys.opera = ua.match(/opera\/([\d.]+)/)[1]; } else if (ua.indexOf('opr')>=0){/* 较新的opera*/ sys.opera = ua.match(/opr\/([\d.]+)/)[1]; } else if (ua.indexOf('msie')>=0){/*早期ie版本*/ sys.ie = parseFloat(ua.match(/msie ([\d.]+)/)[1]) ; } else if (ua.indexOf('trident')>=0){/*ie内核trident*/ sys.ie = parseFloat(ua.match(/trident\/([\d.]+)/)[1]) + 4.0; } else if (ua.indexOf('firefox')>=0){ sys.firefox = ua.match(/firefox\/([\d.]+)/)[1] } else if (ua.indexOf('chrome')>=0){/* chrome的判断必须在safari之前*/ sys.chrome = ua.match(/chrome\/([\d.]+)/)[1] } else if (ua.indexOf('safari')>=0){ sys.safari = ua.match(/version\/([\d.]+)/)[1]; } if (sys.ie) document.write('IE: ' + sys.ie); if (sys.firefox) document.write('Firefox: ' + sys.firefox); if (sys.chrome) document.write('Chrome: ' + sys.chrome); if (sys.opera) document.write('Opera: ' + sys.opera); if (sys.safari) document.write('Safari: ' + sys.safari); </script>

浙公网安备 33010602011771号