()
| 1757 | } |
| 1758 | |
| 1759 | const isMobile = () => { |
| 1760 | // First try the modern way - navigator.userAgentData |
| 1761 | if (navigator.userAgentData?.mobile !== undefined) { |
| 1762 | return navigator.userAgentData.mobile |
| 1763 | } |
| 1764 | |
| 1765 | // Fallback to navigator.maxTouchPoints for iOS devices |
| 1766 | if (navigator.maxTouchPoints && navigator.maxTouchPoints > 1) { |
| 1767 | return true |
| 1768 | } |
| 1769 | |
| 1770 | // Then try matching common mobile screen sizes |
| 1771 | if (window.matchMedia('(max-width: 1024px) and (orientation: portrait), (max-width: 1024px) and (orientation: landscape)').matches) { |
| 1772 | return true |
| 1773 | } |
| 1774 | |
| 1775 | // Finally fall back to UA string detection for older devices |
| 1776 | const ua = navigator.userAgent || navigator.vendor || window.opera |
| 1777 | const modernMobileRE = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Samsung.*Mobile|Mobile.*Firefox|Windows.*Phone|^HTC|LG.*Mobile|BB10|PlayBook|Tablet|Mobile Safari|Chrome.*Mobile/i |
| 1778 | const isMobileDevice = modernMobileRE.test(ua) |
| 1779 | return isMobileDevice |
| 1780 | } |
| 1781 | |
| 1782 | const isIPad = () => { |
| 1783 | const ua = navigator.userAgent |
nothing calls this directly
no outgoing calls
no test coverage detected