Created
September 5, 2013 17:03
-
-
Save dviramontes/6453057 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
var iec = new IECompatibility(); | |
alert('IsIE: ' + iec.IsIE + '\nVersion: ' + iec.Version + '\nCompatability On: ' + iec.IsOn); | |
}); | |
function IECompatibility() { | |
var agentStr = navigator.userAgent; | |
this.IsIE = false; | |
this.IsOn = undefined; //defined only if IE | |
this.Version = undefined; | |
if (agentStr.indexOf("MSIE 7.0") > -1) { | |
this.IsIE = true; | |
this.IsOn = true; | |
if (agentStr.indexOf("Trident/6.0") > -1) { | |
this.Version = 'IE10'; | |
} else if (agentStr.indexOf("Trident/5.0") > -1) { | |
this.Version = 'IE9'; | |
} else if (agentStr.indexOf("Trident/4.0") > -1) { | |
this.Version = 'IE8'; | |
} else { | |
this.IsOn = false; // compatability mimics 7, thus not on | |
this.Version = 'IE7'; | |
} | |
} //IE 7 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment