File size: 589 Bytes
ec17af3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export const isAppleWebKitMobile = () => {
  if (typeof window === "undefined") {
    return false;
  }
  const ua = window.navigator.userAgent;
  const isIOS =
    /iPad|iPhone|iPod/i.test(ua) ||
    (window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1);
  return isIOS;
};

export const isSafariBrowser = () => {
  if (typeof window === "undefined") {
    return false;
  }

  if (isAppleWebKitMobile()) {
    return true;
  }

  const userAgent = window.navigator.userAgent;
  return /safari/i.test(userAgent) && !/chrome|crios|android/i.test(userAgent);
};