IE Detection

JavaScript performance comparison

Test case created by Josh

Info

Fastest way to detect ie8 and lower

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
     
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Object Detection
var legacyIE = (document.all && !document.querySelector || document.all && document.querySelector && !document.addEventListener)? true  : false;

console.log(legacyIE);
pending…
HTML Conditional
function testLegacyIe()
    {
        var test = document.createElement('div');
        test.innerHTML = '<!--[if lte IE 8]>1<![endif]-->';

        var result = false;
        if ('1' === test.innerHTML) result = true;
       
        return(result);
    }

console.log(testLegacyIe());
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 comments

Add a comment