判断IE 浏览器的几种方式

判断IE 浏览器的几种方式

方式一:通过navigator

 参考我的另外一篇博客:

http://hw1287789687.iteye.com/blog/2156337

方式二:通过仅IE可以识别的条件判断

 <script type="text/javascript">
        var isIE8;
    </script>
    <!--不包括IE9-->
    <!--[if lt IE 9]>
        <script>
            isIE8=true;
            alert(isIE8)
        </script>
    <![endif]-->

 范例:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>IE9以下,不包括IE9</title>
    <!--[if lt IE 9]>
    <link rel="stylesheet" media="screen" href="css/ie8_7_6.css" type="text/css"/>
    <![endif]-->
</head>
<body>
<div>判断是不是IE8,IE7,IE6及以下.</div>
</body>
</html>

猜你喜欢

转载自hw1287789687.iteye.com/blog/2324175