mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-26 14:57:18 +10:00
14 lines
385 B
JavaScript
14 lines
385 B
JavaScript
export const isMobileSafari = () => {
|
|
if (!window) {
|
|
return false;
|
|
}
|
|
|
|
// https://stackoverflow.com/a/29696509
|
|
const ua = window.navigator.userAgent;
|
|
const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);
|
|
const webkit = !!ua.match(/WebKit/i);
|
|
|
|
// If iOS Chrome needs to be separated, use `!ua.match(/CriOS/i)` as
|
|
// an extra condition.
|
|
return iOS && webkit;
|
|
};
|