Created
November 20, 2014 06:43
-
-
Save joujiahe/1d56c144d455c07fb10d to your computer and use it in GitHub Desktop.
IE detection in JavaScript
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
function msieversion() { | |
var ua = window.navigator.userAgent, | |
msie = ua.indexOf("MSIE "); | |
// If IE, alert version | |
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) | |
alert(parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)))); | |
else | |
alert('otherbrowser'); | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment