码迷,mamicode.com
首页 > Web开发 > 详细

js-浏览器类型判断

时间:2015-06-15 12:45:50      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

浏览器类型判断

 1 <!DOCTYPE html>
 2 <html>
 3 <head lang="en">
 4 <meta charset="utf-8" />
 5 <title>navigator.userAgent</title>
 6 </head>
 7 
 8 <body>
 9 <script>
10  var isIE = navigator.userAgent.match(/MSIE/)!= null,
11      isIE7 = navigator.userAgent.match(/MSIE 7.0/)!= null,
12      isIE8 = navigator.userAgent.match(/MSIE 8.0/)!= null,
13      isIE9 = navigator.userAgent.match(/MSIE 9.0/)!= null,
14      isIE10 = navigator.userAgent.match(/MSIE 10.0/)!= null,
15      isChrome = navigator.userAgent.match(/Chrome/)!= null,
16      isFirefox = navigator.userAgent.match(/Firefox/)!= null;
17      brower = navigator.userAgent;
18 console.log(brower);
19 console.log(‘isIE:‘ + isIE);
20 console.log(‘isIE7:‘ + isIE7);
21 console.log(‘isIE8:‘ + isIE8);
22 console.log(‘isIE9:‘ + isIE9);
23 console.log(‘isIE10:‘ + isIE10);
24 console.log(‘isChrome:‘ + isChrome);
25 console.log(‘isFirefox:‘ + isFirefox);
26 </script>
27 </body>
28 </html>

 

js-浏览器类型判断

标签:

原文地址:http://www.cnblogs.com/k11590823/p/4576580.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!