Open menu dropdown
isIos
Check whether the page runs on iOS or iPadOS, including iPads that report a desktop Mac user agent.
Usage
ts
import { isIos } from '@maz-ui/utils'
if (isIos()) {
console.log('Running on iOS')
}API
ts
function isIos(): booleanReturns true on iPhone, iPad and iPod, false otherwise (including during SSR).
Detection rules
The check returns true when either:
- the user agent contains
iPhone,iPadoriPod; - the user agent contains
Macintoshand the device has touch support (navigator.maxTouchPoints > 1) - iPadOS 13+ reports a desktop Mac user agent by default.
TIP
Prefer feature detection when it exists (CSS.supports, matchMedia...). Use isIos for behaviors that are specific to the platform, like preventIosInputZoom.