views:

84

answers:

3

How to detect IE7 with jQuery possibly using jQuery.browser?

+3  A: 

See $.browser. This feature has been deprecated and you should consider $.support instead, however I still find occasions where I have to use browser detection instead of feature detection.

James Westgate
@Marcel there are some broken behaviors for which feature detection is really hard to implement. Mostly those are layout bugs. Another example is the problem IE has with varying opacity of images that themselves are PNG images with an alpha channel. How in the world would you "feature detect" that problem?
Pointy
@Pointy – Ah, yes, of course, and the hovering problem in IE 6, and… That said, I would use conditional comments to include different chunks of JavaScript code. That's way more reliable than testing the User Agent string.
Marcel Korpel
+1  A: 

all other things concidered:

if($.browser.msie && $.browser.version == 7)){

    //do something

    };

should work. weather or not it is the right way to go about things is another question.

Nils
+1  A: 

Got a method

if ($.browser.msie  && parseInt($.browser.version) == 7) {
  alert('IE7'); 
} else {
  alert('Non IE7');
}
Mithun P