Skip to content

Commit 2acd078

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 08c9b62 commit 2acd078

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
@@ -98,7 +98,7 @@ if ((typeof document !== 'undefined') && (typeof window !== 'undefined') && (typ
9898
browser.isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
9999
browser.isChrome = !!window.chrome;
100100
browser.isChromeHeadless = navigator.userAgent.indexOf('HeadlessChrome') >= 0;
101-
browser.chromeVersion = (browser.isChrome || browser.isChromeHeadless) ? parseInt(navigator.userAgent.match(/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/)[1]) : 0;
101+
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;
102102
browser.isWin = navigator.userAgent.indexOf('Windows') >= 0;
103103
}
104104
browser.android = /android/i.test(navigator.userAgent);

0 commit comments

Comments
 (0)