| 123456789101112131415161718192021 |
- export const isIOS = () => {
- // Client-only: SSR should always return false.
- if (!import.meta.client) return false
- try {
- const ua = (navigator.userAgent || '').toLowerCase()
- if (/iphone|ipad|ipod/.test(ua)) return true
- // iPadOS 13+ may report itself as "Macintosh" in desktop mode.
- // Detect it by combining platform + touch capability.
- const nav = navigator as Navigator & { maxTouchPoints?: number }
- const platform = (nav.platform || '').toLowerCase()
- const touchPoints = Number(nav.maxTouchPoints || 0)
- if (platform === 'macintel' && touchPoints > 1) return true
- }
- catch {
- // ignore
- }
- return false
- }
|