jQuery使用jQuery.support而不是jQuery.browser检测IE6 [英] jQuery detect IE6 using jQuery.support NOT jQuery.browser

查看:74
本文介绍了jQuery使用jQuery.support而不是jQuery.browser检测IE6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有找到一种确定的方法来使用jquery.support而不是不再支持的jquery.browser来检测IE6.另外我还需要考虑Quirks模式,哎呀!

I have found no definite way to detect IE6 using jquery.support instead of jquery.browser which is not supported anymore. Also I need to account for Quirks mode, Ugh!!!

我在Stack上看到过几篇文章,但它们都引用了jquery.browser,而有关jquery.support的文档有些含糊.

I have seen a couple of posts on Stack but they all refer to jquery.browser and the documentation for jquery.support is a little vague.

在此方面的任何帮助都将非常有用,并在此先感谢.

Any help on this would be great and thanks in advance.

推荐答案

我认为jQuery简单的作者不希望开发人员检查哪个浏览器正在运行该应用程序/网站.相反,他们希望我们检查不同的浏览器功能并根据该功能决定要做什么.不管是IE6,IE8,Firefox还是某些新浏览器,都没有关系.作为应用程序开发人员,您应该了解浏览器对不同功能的支持如何影响用户使用应用程序的能力,因此您应该采取相应的行动.

I think that the authors of jQuery simple don't want developers to check for which browser is running the application/website anymore. Instead they want us to check different browser features and decide on what to do based on that. It doesn't matter if it's IE6, IE8, Firefox or some new browser. As the application developer you should know how the browser support for different features affects the user's ability to work with your application and you should act accordingly.

$.browser取决于使用用户代理字符串的浏览器嗅探.不可靠,尤其是因为用户很容易在其浏览器上欺骗用户代理,而不是我出于担心布局的目的而担心-如果他们更改了用户代理,那么他们的IE6会以IE7的形式呈现,这是他们的错页面正确. ;)

$.browser depends on browser sniffing using the User Agent strings which may be unreliable, especially since it's very easy for users to spoof the User Agent on their browser, not that I would worry about it for layout purposes - if they changed their User Agent then it's their fault that their IE6 presenting itself as IE7 fails to render the page correctly. ;)

尽管已弃用$ .browser,但仍可以使用$ .browser或尝试自己编写一些代码.也许已经有一个jQuery插件了?我知道上次必须检查IE6时才使用该方法...

You can either still use $.browser, despite the fact that it's been deprecated or try to code something on your own. Maybe there's a jQuery plugin for that already? I know that last time I had to check for IE6 I used that method...

这篇关于jQuery使用jQuery.support而不是jQuery.browser检测IE6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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