Skip to content

Instantly share code, notes, and snippets.

@directionforward
Forked from codearryaas/detect-ios.js
Created January 21, 2021 11:53
Show Gist options
  • Save directionforward/28536cffd57ac3dafdd43aa0a9e44b2d to your computer and use it in GitHub Desktop.
Save directionforward/28536cffd57ac3dafdd43aa0a9e44b2d to your computer and use it in GitHub Desktop.
JavaScript: How to detect if device is iOS?
var isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
if (isIOS) {
console.log('This is a IOS device');
} else {
console.log('This is Not a IOS device');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment