jQuery IE version detection : jquery thickbox ie fix

There are threads galore in various jquery discussion groups and blogs about the problems with IE7's user agent info, which, on some installations, returns version '6'.

In my case, I have the exact same numeric version of IE7 on two different vista computers, and one shows up as IE6 while the other shows itself to jquery as version 7.
(No idea why, and unless somebody can explain it i am done pondering the mystery - it hurts my head!)

This recently surfaced as a serious problem with my use of the incredible, wonderful "thickbox" plugin - a jquery lightbox plugin with tons of feature (more about that here )

Anyway, after much digging and scratching (ok, googling and clicking for you realistic non-metaphorical types), I found a few browser detection scripts with a different spin for IE7.

The first one, which obviously has worked for many users, did not work for me. Bummer.
Jamie obviously put a lot of effort into bringing this simple ie thickbox patch to the masses. But for whatever reason (did I mention I am done thinking about the reason?!?) my stubborn-as-I-am IE7 still wanted to look like a 6 to jQuery.
Then, I found this thread on Nabble, and worked it into a test page. Lo and behold, the fix appeared before my eyes.

/// here is the fix ///

if ( document.all && !window.opera && !window.XMLHttpRequest && $.browser.msie )
{var isIE6 = true;}
else
{ var isIE6 = false;} ;
$.browser.msie6 = isIE6;

/// end fix ///

You can then use the  value of " $.browser.msie6 " , which will either be 'true' or 'false', to work your various IE-specific magicnesses.
In my case, thickbox now centers just as it should in both of my IE7's !

Here is my test page with the full browser user-agent info.
Point your IE7 here and see what you see.
It will show either 6 or 7 as the version info, but either way the last line, 'msie6', should read false.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Thank you
You really saved me with this! :)
# Author vvvlad | 8/1/08 9:58 PM
Finally !!!! Thank You!!!!
# Author Adi | 12/29/08 1:55 PM
Thank you. I saved a lot of time. :))
# Author Umut Benzer | 5/3/09 12:08 PM
When your IE7 is an upgrade from IE6, this stupid thing happens. Fresh installs of IE7 (not an upgrade) is OK.
# Author Yalcin | 5/25/09 10:10 PM
$.browser.version = $.browser.msie && parseInt($.browser.version) >= 6 && window["XMLHttpRequest"] ? "7.0" : $.browser.version;

$.browser.version will now return correct value for any browser (I have doubts about IE8, where it will probably return "7.0")
# Author Yalcin | 5/25/09 10:13 PM
@Yalcin

>> When your IE7 is an upgrade from IE6, this stupid thing happens.

AHA! Thanks for posting this valuable point. In all my searches before, and discussions since I posted this fix, nobody brought that up. That makes it a *little* more logical.
# Author Michael Evangelista | 5/25/09 11:12 PM
blogcfc 5.9.1.002 by raymond camden
contact michael evangelista