Feature detection method

suggest change

The checks below are browser sniffing from around 2016, not feature detection. They do not identify current Firefox, Chrome, or Chromium Edge. InstallTrigger, chrome.webstore, and StyleMedia are gone or meaningless there. Test the API you need, as in Detecting browser capabilities.

// Opera 8.0+
const isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;

// Firefox 1.0+
const isFirefox = typeof InstallTrigger !== 'undefined';
    
// At least Safari 3+: "[object HTMLElementConstructor]"
const isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;

// Internet Explorer 6-11
const isIE = /*@cc_on!@*/false || !!document.documentMode;

// Edge 20+
const isEdge = !isIE && !!window.StyleMedia;

// Chrome 1+
const isChrome = !!window.chrome && !!window.chrome.webstore;

// Blink engine detection
const isBlink = (isChrome || isOpera) && !!window.CSS;

Reported against these old versions only:

Credit to Rob W

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents