$ .browser的替代品是什么 [英] What's the replacement for $.browser

查看:124
本文介绍了$ .browser的替代品是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已弃用jQuery文档标记$.browser.那有什么替代品呢?

The jQuery document tags $.browser as deprecated. So what's the replacement for it?

推荐答案

如果您确实需要旧的$ .browser

根据 docs ,该功能在 1.3 中已弃用 尽管在官方jQuery Migrate插件中仍然可用,但在 1.9 中已将其完全删除. .

If you really need good old $.browser

According to the docs, this feature was deprecated in 1.3, and totally removed in 1.9, although it is still available in the official jQuery Migrate plugin.

取决于浏览器检测 Modernizr 是实现此目的的绝佳工具). jQuery有一个$.support()方法来提供某些功能检测,但现在也不建议使用. 他们还建议使用Modernizer.

Depending on browser detection is not a good idea. Feature detection is the way to go (Modernizr is a great tool for that). jQuery had a $.support() method to provide some feature detection, but it is now deprecated as well. They also suggest using Modernizer.

修正浏览器怪癖不是检测浏览器的有效用例,但还有其他用例.使用任何Javascript浏览器检测工具(例如 bowser ),因为此功能完全不依赖jQuery.

Fixing browser quirks is not a valid use case for browser detection, but there are other use cases. Use any Javascript browser detection tool (like bowser), as this functionality does not depend on jQuery at all.

这篇关于$ .browser的替代品是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆