使用jQuery检测IE

$(window).load(function () {
   if($.browser.msie && $.browser.version=="6.0") {
     // do stuff
   }
});

刚刚意识到$ .browser已经在1.3中被折旧了。什么是检测IE的新方法,特别是IE6。

解决方法

jQuery documentation for jQuery.browser显示以下警告:

We recommend against using this property,please try to use feature detection instead (see 07001).

> $ .support.Boxmodel在IE 6和7中为false。
> $ .support.cssFloat对于IE 6,7和8为false;这在IE 9中是正确的。
> $ .support.leadingWhitespace对于IE 6,7和8为false。
> $ .support.objectAll对于IE 6,7和8而言当前为false。

请注意,文档中显示以下注释:

jQuery comes with a number of properties included,you should feel free to add your own. Many of these properties are rather low-level so it’s doubtful that they’ll be useful in general day-to-day development,but mostly used by plugin and core developers.

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...