Very small IE detect
http://benalman.com/
by davidmurdoch
HTML
<!-- See http://gist.github.com/542301 -->
JavaScript
/*
* Let's pretend we are in some sort of production code
* and wrap things up in an IIFE
* (http://benalman.com/news/2010/11/immediately-invoked-function-expression/).
* Any function(){} block would emulate this behavior.
*/
(function(){
// Very small IE detect (aka type coersion ftw) by cowboy (Ben Alman)
with(document.createElement("b"))for(var ie=-1;innerHTML="<!--[if gt IE "+ ++ie+"]>1<![endif]-->",+innerHTML;);
document.write("ie = " + ie + " (" + typeof ie + ")<br>");
}());
document.write([
"",
"<b>Tests for global pollution</b>",
"window.ie = " + window.ie,
"window.innerHTML = " + window.innerHTML
].join("<br>"));