m7v
5/11/2016 - 5:21 AM

Check browsers

Check browsers

// please note,
// that IE11 now returns undefined again for window.chrome
// and new Opera 30 outputs true for window.chrome
// and new IE Edge outputs to true now for window.chrome
// and if not iOS Chrome check
// so use the below updated condition
var isChromium = window.chrome,
    winNav = window.navigator,
    vendorName = winNav.vendor,
    isOpera = winNav.userAgent.indexOf("OPR") > -1,
    isIEedge = winNav.userAgent.indexOf("Edge") > -1,
    isIOSChrome = winNav.userAgent.match("CriOS");

if(isIOSChrome){
   // is Google Chrome on IOS
}
else if(isChromium !== null &&
  isChromium !== undefined &&
  vendorName === "Google Inc." &&
  isOpera === false &&
  isIEedge === false) {
   // is Google Chrome
}
else { 
   // not Google Chrome
}