Created
July 11, 2018 20:31
-
-
Save atomize/8688e23d72a702500e25bfe5c2a5f245 to your computer and use it in GitHub Desktop.
Check browser for Microsoft Edge/IE
This file contains hidden or 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
var get_ie_version = function () { | |
var sAgent = window.navigator.userAgent; | |
var Idx = sAgent.indexOf("MSIE"); | |
// If IE, return version number. | |
if (Idx > 0) { | |
return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx))); | |
} | |
// Condition Check IF IE 11 and or MS Edge | |
else if ( !!navigator.userAgent.match(/Trident\/7\./) | |
|| window.navigator.userAgent.indexOf("Edge") > -1 ) | |
{ | |
return 11; | |
} else { | |
return 0; //It is not IE | |
} | |
}; | |
//[https://stackoverflow.com/questions/31721250/how-to-target-windows-10-edge-browser-with-javascript] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment