Skip to content

Instantly share code, notes, and snippets.

@djalmajr
Last active November 20, 2018 15:33
Show Gist options
  • Save djalmajr/dfe6c59fe9296d149ec795f124ad8719 to your computer and use it in GitHub Desktop.
Save djalmajr/dfe6c59fe9296d149ec795f124ad8719 to your computer and use it in GitHub Desktop.
var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(" OPR/") >= 0
, isIE = /*@cc_on!@*/false || !!document.documentMode
, isChrome = !!window.chrome && !!window.chrome.webstore;
window.__BrowserDetection = {
// Opera 8.0+
isOpera: isOpera,
// Firefox 1.0+
isFirefox: typeof InstallTrigger !== "undefined",
// At least Safari 3+: "[object HTMLElementConstructor]"
isSafari: Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor") > 0,
// Internet Explorer 6-11
isIE: isIE,
// Edge 20+
isEdge: !isIE && !!window.StyleMedia,
// Chrome 1+
isChrome: isChrome,
// Blink engine detection
isBlink: (isChrome || isOpera) && !!window.CSS,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment