Check whether a user agent represents iOS or iPadOS.
Without an argument, the function reads the current navigator.userAgent.
It also recognizes iPadOS browsers that identify as macOS by checking the
current navigator.platform and navigator.maxTouchPoints compatibility
signals. An explicit user agent is classified by that string alone.
Usage:
import { isIOS } from"mazey";
constresult = isIOS(); console.log(result);
Possible output:
true
Parameters
OptionaluserAgent: string
Optional user-agent string. Defaults to the current browser's user agent.
Returns boolean
true for recognized iOS or iPadOS user agents; otherwise false.
Throws
If an explicitly supplied user agent is not a string.
Remarks
Safe during SSR and in Node.js. User-agent detection is heuristic and spoofable; do not use this result as a security boundary.
Check whether a user agent represents iOS or iPadOS.
Without an argument, the function reads the current
navigator.userAgent. It also recognizes iPadOS browsers that identify as macOS by checking the currentnavigator.platformandnavigator.maxTouchPointscompatibility signals. An explicit user agent is classified by that string alone.Usage:
Possible output: