jQuery 类型错误:“未定义”不是对象(正在评估“$.browser.msie”)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14518300/
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-08-26 13:40:05  来源:igfitidea点击:

TypeError: 'undefined' is not an object (evaluating '$.browser.msie')

jquery

提问by Aleksov

Possible Duplicate:
jQuery latest $.browser

可能的重复:
jQuery 最新的 $.browser

There was an error with jQuery 1.9 and $.browser; It returns 'undefined' for any $.browser; function. What i did wrong?

jQuery 1.9 和 $.browser 出现错误;它为任何 $.browser 返回 'undefined';功能。我做错了什么?

TypeError: 'undefined' is not an object (evaluating '$.browser.msie')

类型错误:“未定义”不是对象(正在评估“$.browser.msie”)

I use following code:

我使用以下代码:

setTimeout(function(){if($.browser.msie){$('.ovy').animate({top:"0"},ct);

回答by Marwelln

$.browserhave been removed from 1.9. You can use jQuery Migrateto have $.browsersupport.

$.browser已经从1.9去除。您可以使用jQuery Migrate来获得$.browser支持。

回答by Aleksov

I solved this problem like this

我这样解决了这个问题

if(navigator.appVersion.indexOf("MSIE") !== -1){
    // Only MSIE will evaluate this code
}

回答by Ohgodwhy

$.browserhas been removed as of jQuery 1.9. If you want to continue making use of it, you'll need to use the jQuery migrateplugin.

$.browser已从 jQuery 1.9 删除。如果你想继续使用它,你需要使用 jQuerymigrate插件。