不要在IE8及以下版本中加载脚本?

Ric*_*ard 4 html browser internet-explorer conditional-comments

这个问题必须重复,但我在这里找不到明确的答案.

如果浏览器是IE8或更低版本,如何告诉浏览器不加载脚本?

我知道针对IE9及以上的目标:

<!--[if gte IE 8]>
 According to the conditional comment this is IE 8 or higher<br />
<![endif]-->
Run Code Online (Sandbox Code Playgroud)

但是然后脚本不会加载到非IE浏览器中.

如果不是IE,或者如果IE和IE8以上,我该如何说"加载脚本"?

Abi*_*tro 21

"IE8除外"的条件评论?

<!--[if gte IE 9]><!-->
    // Your script here. This will only be loaded if IE version is greater than 8, OR any other browser.
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)

应该管用?

  • @JohanB抱歉,您可以选择任何您喜欢的解决方案.那时我是新来的:) (2认同)