简体   繁体   English

如何不在IE8或更早版本上执行脚本?

[英]How to not to execute a script on IE8 or older?

I have a function that calls many functions which are not supported by IE8, so I am looking for how to disable executing this script for IE8. 我有一个函数可以调用IE8不支持的许多函数,因此我正在寻找如何禁用对IE8执行此脚本的方法。 I saw many solutions like using HTML comments: 我看到了许多使用HTML注释的解决方案:

<!--[if !IE]> --> Code <!-- <![endif]--><!--[if IE]>

But I want disabling IE8 interpretation inside a function, because there are other scripts that run correctly on IE8. 但是我想在一个函数中禁用IE8解释,因为还有其他脚本可以在IE8上正确运行。

There is a function in jQuery "jQuery.browser()" but it has been deprecated. jQuery中有一个函数“ jQuery.browser()”,但已弃用。

Could you please tell me how to resolve this issue? 您能否告诉我如何解决此问题?

Thank you in advance. 先感谢您。

Maybe this will help: 也许这会有所帮助:

if (navigator.userAgent.match(/MSIE 8/) == null) {
  // do something !IE8
}

from: 从:

how do I run a script only for IE 8 我如何只为IE 8运行脚本

Browser detection in JavaScript? JavaScript中的浏览器检测?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM