javascript $.browser.msie 和 IE9

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6655177/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 21:25:16  来源:igfitidea点击:

$.browser.msie and IE9

javascriptjqueryinternet-explorer

提问by Stewie Griffin

I am trying to detect ALL versions of IE by using jquery $.browser.msie. It works for 8, 7, 6, but it ignores IE9. Why is that and what is a solution for javascript to detect ie9?

我正在尝试使用 jquery 检测所有版本的 IE $.browser.msie。它适用于 8、7、6,但它忽略了 IE9。为什么会这样,javascript 检测 ie9 的解决方案是什么?

JS version: jQuery JavaScript Library v1.5

JS 版本:jQuery JavaScript 库v1.5

回答by Rene Pot

As of version 1.9of jQuery $.browseris no longer supported. Use jQuery.suportinstead. With this change you'll need to check on what functionality you want to check. So just browser check is no longer supported in it. It is recommended to do a feature check instead of browser check.

不再支持1.9jQuery版本$.browser。使用jQuery.suport来代替。通过此更改,您需要检查要检查的功能。所以它不再支持浏览器检查。建议进行功能检查而不是浏览器检查。

Docs here

文档在这里

回答by George Cummins

IE9 can emulate older browsers, causing the variety of "works/doesn't work" responses you see here.

IE9 可以模拟较旧的浏览器,从而导致您在此处看到的各种“有效/无效”响应。

"Trident/5.0" is present in IE9's user-agent string in all modes, according to this SO question.

根据这个 SO question,“Trident/5.0”在所有模式下都出现在 IE9 的用户代理字符串中。

回答by Andy

回答by thomas

you can override the detection of IE noFullScreen: { msie: /msie [0-6]/, ... } to noFullScreen: { msie: /abcdefgh/ }

您可以将 IE noFullScreen: { msie: /msie [0-6]/, ... } 的检测覆盖到 noFullScreen: { msie: /abcdefgh/ }