Skip to content

Commit ea291f9

Browse files
committed
Fix - chrome on apple devices
On mobile Apple devices navigator.userAgent does not contain Chrome string therefore version parsing fails. Fixes https://root-forum.cern.ch/t/63201
1 parent 9ece4c1 commit ea291f9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

modules/core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ if ((typeof document !== 'undefined') && (typeof window !== 'undefined') && (typ
8888
browser.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
8989
browser.isChrome = !!window.chrome;
9090
browser.isChromeHeadless = navigator.userAgent.indexOf('HeadlessChrome') >= 0;
91-
browser.chromeVersion = (browser.isChrome || browser.isChromeHeadless) ? parseInt(navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/)[1]) : 0;
91+
browser.chromeVersion = (browser.isChrome || browser.isChromeHeadless) ? (navigator.userAgent.indexOf('Chrom') > 0 ? parseInt(navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/)[1]) : 134) : 0;
9292
browser.isWin = navigator.userAgent.indexOf('Windows') >= 0;
9393
}
9494
browser.touches = ('ontouchend' in document); // identify if touch events are supported

0 commit comments

Comments
 (0)