如果用户使用IE8浏览,则禁用脚本

joh*_*han 5 javascript internet-explorer internet-explorer-8

我想要一个JavaScript代码来禁用我在用户使用Internet Explorer 8浏览时创建的脚本.

nav*_*een 13

试试这个.

用于禁用IE 8的脚本

<!--[if !(IE 8)]><!-->
    <script src="path/to/external/script"></script>
    <script>
        // your inline script goes here
    </script>
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)

用于禁用IE 8及更高版本的脚本

<!--[if !(gte IE 8)]><!-->
    <script src="path/to/external/script"></script>
    <script>
        // your inline script goes here
    </script>
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)

阅读bobince的答案:"IE8除外"的条件评论?