Detecting IE7+ in JavaScript

Abe Fettig knows that we need to start detecting the difference between IE6- and IE7+, because a lot of the hacks that we were using for IE are no longer needed. He didn't want to grok the user agent, as that is very brittle, so he came up with:
JAVASCRIPT:
  1. if (typeof document.body.style.maxHeight != "undefined") {
  2. // IE 7, mozilla, safari, opera 9
  3. } else {
  4. // IE6, older browsers
  5. }
Any other thoughts?

Detecting IE7+ in JavaScript

Abe Fettig knows that we need to start detecting the difference between IE6- and IE7+, because a lot of the hacks that we were using for IE are no longer needed.

He didn't want to grok the user agent, as that is very brittle, so he came up with:

JAVASCRIPT:
  1.  
  2. if (typeof document.body.style.maxHeight != "undefined") {
  3.   // IE 7, mozilla, safari, opera 9
  4. } else {
  5.   // IE6, older browsers
  6. }
  7.  

Any other thoughts?


October 10th, 2006

Tagged View

Tags Similar

Posts Fresh +

Categories View

Archives View

Zero. Zilch. Nada. None. No commento.