您的位置:首页 > 其它

判断IE浏览器版本以及非IE客户端

2018-01-26 15:29 267 查看
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<title> doublecolorball </title>
</head>
<body>
<button onclick="test()">test</button>

<script type="text/javascript">
var ua = navigator.userAgent;
if(/MSIE/i.test(ua) == true)
{

if(/MSIE 10/i.test( ua ) == true)
{
alert('ie10');
}
else if(/MSIE 9/i.test( ua ) == true)
{
alert('ie9');
}
else if(/MSIE 8/i.test( ua ) == true)
{
alert('ie8');
}
else if(/MSIE 7/i.test( ua ) == true)
{
alert('ie7');
}
else if(/MSIE 6/i.test( ua ) == true)
{
alert('ie6');
}
}
else if((/Windows/i.test(ua)) && (/Trident/i.test(ua)) && (/rv:11.0/i.test(ua)))
{
alert('ie11');
}
else
{
alert('不是ie浏览器');
}
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: