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");
}
you can always do this sort of thing with html or css...why do it with jquery?
the method in the update #2 above, i.e. checking for the
XMLHttpRequest
member on the window, can fail in cases where some other library has polyfilled support. You're best bet is going to be to use conditional comments, this page has an excellent explanation.hope that helps! cheers.