Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Created May 17, 2011 02:23
Show Gist options
  • Save Takazudo/975771 to your computer and use it in GitHub Desktop.
Save Takazudo/975771 to your computer and use it in GitHub Desktop.
/**
* browser sinffing
* http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
*/
(function(){
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]-->',
all[0]
);
return v > 4 ? v : undef;
}());
/* jQuery interface */
$.browser.ie6 = (ie === 6);
$.browser.ielt7 = (ie < 7);
$.browser.ie7 = (ie === 7);
$.browser.ielt8 = (ie < 8);
$.browser.ie8 = (ie === 8);
$.browser.ielt9 = (ie < 9);
$.browser.ie9 = (ie === 9);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment