/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var ie=(function(){var undef,v=3,div=document.createElement('div');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',div.getElementsByTagName('ivar ie=(function(){var undef,v=3,div=document.createElement('div');while(div.innerHTML='<!--[if gt IE '+(++v)+']><i></i><![endif]-->',div.getElementsByTagName('i')[0]);return v>4?v:undef}());')[0]);return v>4?v:undef}()); // it's a minimized/compressed, self execution (no library required) // example: alert(ie); // return undefined (if the browser was not IE) // or // return browser version (if IE detected)