blob: ec1034f0f714606f78ba01fe8cd6bb78897f4ac4 [file] [log] [blame]
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +02001const UA = navigator.userAgent;
2const testElement = document.createElement( 'div' );
3
4export const isMobile = /(iphone|ipod|ipad|android)/gi.test( UA ) ||
5 ( navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1 ); // iPadOS
6
7export const isChrome = /chrome/i.test( UA ) && !/edge/i.test( UA );
8
9export const isAndroid = /android/gi.test( UA );
10
11// Flags if we should use zoom instead of transform to scale
12// up slides. Zoom produces crisper results but has a lot of
13// xbrowser quirks so we only use it in whitelisted browsers.
14export const supportsZoom = 'zoom' in testElement.style && !isMobile &&
15 ( isChrome || /Version\/[\d\.]+.*Safari/.test( UA ) );