Last active
April 4, 2017 10:14
-
-
Save Jibbarth/1ebb107379b4ff515cd64ef4fcd529df to your computer and use it in GitHub Desktop.
Get Internet Explorer version and get is Edge Navigator 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
/** | |
* Gets the internet explorer version. | |
* | |
* @return {int} The internet explorer version. | |
*/ | |
function getInternetExplorerVersion() { | |
var rv = -1; | |
if (navigator.appName == 'Microsoft Internet Explorer') { | |
var ua = navigator.userAgent; | |
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); | |
if (re.exec(ua) != null) { | |
rv = parseFloat(RegExp.$1); | |
} | |
} else if (navigator.appName == 'Netscape') { | |
var ua = navigator.userAgent; | |
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); | |
if (re.exec(ua) != null) { | |
rv = parseFloat(RegExp.$1); | |
} | |
} | |
return rv; | |
} | |
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
/** | |
* Determines if edge navigator. | |
* | |
* @return {boolean} True if edge navigator, False otherwise. | |
*/ | |
function isEDGENavigator(){ | |
var isEdge = false; | |
if(navigator.appName == "Netscape"){ | |
isEdge = (navigator.appVersion.indexOf('Edge') > -1); | |
} | |
return isEdge; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment