浏览器类别版本,直接运行下面的代码即可判别浏览器版本。
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>浏览器类别版本</title>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
<script type="text/javascript">
var btv = {};
var ua = navigator.userAgent.toLowerCase();
var temp;
(temp = ua.match(/msie ([\d.]+)/))? btv.ie = temp[1]:
(temp = ua.match(/firefox\/([\d.]+)/))?btv.ff = temp[1]:
(temp = ua.match(/chrome\/([\d.]+)/))?btv.chrome = temp[1]:
(temp = ua.match(/version\/([\d.]+).*safari/))?btv.safari = temp[1]:
(temp = ua.match(/opera\/([\d.]+)/))?btv.opera = temp[1]:-1;
/*测试*/
if (btv.ie) document.write('IE: ' + btv.ie);
if (btv.ff) document.write('Firefox: ' + btv.ff);
if (btv.chrome) document.write('Chrome: ' + btv.chrome);
if (btv.opera) document.write('Opera: ' + btv.opera);
if (btv.safari) document.write('Safari: ' + btv.safari);
</script>
</head>
<body style="padding:80px;">
</body>
</html>