views:

849

answers:

1

Guys,

I am trying to establish how to detect the IE browser in jQuery 1.3.X - now before you all write "its deprecated in 1.3.x!" - I know this. I have this code

if (jQuery.browser.msie && jQuery.browser.version == "6.0") {
  alert ("This is less than IE7");
} else {
  alert ("This is greater than IE7");
}

When running it in IE8 - IE6 (quirks), IE7 and IE8 all return "less than IE7". Can anyone help me determine this correctly using jquery ? (please note: using jquery)

Edit: I am trying to basically change the position element in IE6 to "absolute" and use "fixed" for IE7 and IE8. Not sure how to do this without detecting browser?

Edit2: Seems something like this might work?

   if ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined)) {
     alert ("This is not IE6");
       } else {
     alert ("This is greater than IE6"); 
       }
+2  A: 

you can always do this sort of thing with html or css...why do it with jquery?

codedude
He's talking about conditional comments or css hacks by the way. Conditional comments are the way to go here.
Rich Bradshaw
More info on condtional comments here: http://www.quirksmode.org/css/condcom.html
rlovtang