Skip to content

Instantly share code, notes, and snippets.

@replete
replete / gist:2384817
Created April 14, 2012 14:36
Detect IE version 5-9 (based on conditional comments)
/* Don't forget, the currently unreleased IE10 is supposedly dropping support for conditional comments
so we'll need something else in this function to detect IE10 (hopefully, we'll never need to) */
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
while (
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->',