Side navigation
#1015 closed enhancement (fixed)
Opened March 01, 2007 04:44PM UTC
Closed June 01, 2007 03:26AM UTC
Last modified March 15, 2012 05:48PM UTC
Add IE6 detection to $.browser
Reported by: | joern | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.1.3 |
Component: | core | Version: | 1.1.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Mike proposed this implementation:
var b = navigator.userAgent.toLowerCase(); // Figure out what browser is being used jQuery.browser = { safari: /webkit/.test(b), opera: /opera/.test(b), msie: /msie/.test(b) && !/opera/.test(b), msie6: /msie 6.0/.test(b) && !/opera/.test(b), mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b) };
Attachments (0)
Change History (2)
Changed March 07, 2007 10:27PM UTC by comment:1
Changed June 01, 2007 03:26AM UTC by comment:2
description: | Mike proposed this implementation:\ \ {{{\ var b = navigator.userAgent.toLowerCase();\ \ // Figure out what browser is being used\ jQuery.browser = {\ safari: /webkit/.test(b),\ opera: /opera/.test(b),\ msie: /msie/.test(b) && !/opera/.test(b),\ msie6: /msie 6.0/.test(b) && !/opera/.test(b),\ mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b)\ };\ }}} → Mike proposed this implementation: \ \ {{{ \ var b = navigator.userAgent.toLowerCase(); \ \ // Figure out what browser is being used \ jQuery.browser = { \ safari: /webkit/.test(b), \ opera: /opera/.test(b), \ msie: /msie/.test(b) && !/opera/.test(b), \ msie6: /msie 6.0/.test(b) && !/opera/.test(b), \ mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b) \ }; \ }}} |
---|---|
need: | → Review |
resolution: | → fixed |
status: | new → closed |
This is now fixed in SVN with the addition of a version property to the browser object.
If we need to add version detection, we should add it in a manner that is consistent across browsers and versions. Detecting IE6 is fundamentally the same as detecting IE7, 5, 8 or FF 1.0, so maybe we should provide a $.browser.version instead. I realize that $.browser.msie6 is way simpler than $.browser.msie && ($.browser.version == 6), but imagine how jQ source will look like when we add a variable for every major browser version.
By the way, is there any rational idea in syntax that looks like this?
$("msie[@version=6]", $.browser) or $("mozilla[@version<1.5]", $.browser)