在jQuery中检测Internet Explorer 6或更低版本

在jQuery中检测Internet Explorer 6或更低版本

问题描述:

我是jquery的新手,我想知道:这是检测浏览器是否为Internet Explorer 6或更低版本的简单方法吗?

I'm new to jquery and was wondering: is a simple way to detect whether a browser is Internet Explorer 6 or below?

就这么简单:

if($.browser.msie && $.browser.version=="6.0") alert("Im the annoying IE6");

更新

请注意, $ .browser 如果您仍需要在jQuery 1.9(或其他不建议使用的功能)中使用$ .browser,请尝试jQuery-migrate( http://code.jquery.com/jquery-migrate-1.2.1.js )

If you still need to use $.browser in jQuery 1.9 (or other deprecated functions), try jQuery-migrate (https://github.com/jquery/jquery-migrate/ - http://code.jquery.com/jquery-migrate-1.2.1.js)