Created
November 20, 2018 10:43
-
-
Save haroonabbasi/6ad7120bf931e64d3ca785bf945887af to your computer and use it in GitHub Desktop.
Detect Browser Type : Internet Explorer
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
/* Sample function that returns boolean in case the browser is Internet Explorer*/ | |
function isIE() { | |
ua = navigator.userAgent; | |
/* MSIE used to detect old browsers and Trident used to newer ones*/ | |
var is_ie = ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1; | |
return is_ie; | |
} | |
/* Create an alert to show if the browser is IE or not */ | |
if (isIE()){ | |
alert('It is InternetExplorer'); | |
}else{ | |
alert('It is NOT InternetExplorer'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment