Can someone tell me if I am correct in believing that jQuery's $.browser is/has been deprecated?

Will my existing implementations continue to work? If not, is there an easy to implement alternative.

推荐答案

the documentation:

The $.browser property is deprecated in jQuery 1.3, and its functionality may be moved to a team-supported plugin in a future release of jQuery.

所以,是的,它已被弃用,但您现有的实现将继续工作.如果删除了该功能,则可以使用插件轻松访问该功能.

As to whether there is an alternative... The answer is "yes, probably". It is far, far better to do feature detection using $.support rather than browser detection: detect the actual feature you need, not the browser that provides it. Most important features that vary from browser to browser are detected with that.


Update 16 February 2013: In jQuery 1.9, this feature was removed (docs). It is far better not to use it. If you really, really must use its functionality, you can restore it with the jQuery Migrate plugin.

Jquery相关问答推荐

在 textarea 输入中美化 json 数据

jQuery非只读 Select 器

JSLint 错误:将调用移动到包含函数的括号中

如何在 bootstrap 模式关闭并重新打开时重置 bootstrap 模式?

如何在数据表中显示空数据消息

是否可以使用 javascript 打开一个弹出窗口,然后检测用户何时关闭它?

jQuery 的 ajax 默认超时值是多少?

非 AJAX jQuery POST 请求

jQuery Keypress 箭头键

jQuery scrollTop 在 Chrome 中不工作但在 Firefox 中工作

如何禁用在div内单击

如果 iframe src 无法加载,则捕获错误.错误:-拒绝在框架中显示 'http://www.google.co.in/'..

类方法中的Typescript this

使用 jQuery 比较两个 Javascript 对象数组

Bootstrap datepicker Select 后隐藏

JavaScript 等效于 jQuery 的扩展方法

单击时平滑滚动到特定的 div

D3 和​​ jQuery 有什么区别?

jquery追加到列表的前面/顶部

JavaScript 在 DOM 中移动元素