Detect Internet Explorer 6 or below in jQuery

As simple as this:

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

Update

Please note that $.browser is removed from jQuery 1.9

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)


You could also ask IE directly.

<!--[if lte IE 6]>
<script type="text/javascript">
  var isRunningIE6OrBelow = true;
</script>
<![endif]-->

jQuery checks for features, rather than "browsers". That said, you can use the jQuery.support method to detect what the users browser is capable of.

Deprecated Methods (Do not use)

  • $.browser
  • $.browser.version
  • $.boxModel

https://api.jquery.com/jQuery.support will give you a summary of which features are supported by which browsers. Taking that data, you'll develop a couple conditional checks to determine if the browser being used is your target browser or not.


if ($.browser.msie && parseInt($.browser.version, 10) <= 6) {
  alert("I'm not dead yet!"); 
}

-- update

Please not that $.browser is removed from jQuery 1.9