Last active
May 1, 2020 19:35
-
-
Save stereokai/8b187d74ba773eba0d12 to your computer and use it in GitHub Desktop.
Real, precise, futureproof javascript browser detection
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
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera) | |
isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; | |
// Firefox 1.0+ | |
isFirefox = typeof InstallTrigger !== 'undefined'; | |
// At least Safari 3+: "[object HTMLElementConstructor]" | |
isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; | |
// At least IE6 | |
isIE = /*@cc_on!@*/false || !!document.documentMode; | |
// Edge | |
isEdge = !!window.MSAssertion; | |
// Chrome 1+ | |
isChrome = !!window.chrome && !!window.chrome.webstore; | |
// Blink | |
isBlink = (isChrome || isOpera) && !!window.CSS; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment