Created
October 22, 2014 20:25
-
-
Save gregkepler/5691453af088d8192112 to your computer and use it in GitHub Desktop.
Snippets for detecting if browser is on an android or iOS device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is android | |
var isAndroid = navigator.userAgent.toLowerCase().indexOf("android") > -1; | |
// ios detection | |
var isIOS = false; | |
var iDevice = ['iPad', 'iPhone', 'iPod']; | |
for ( i = 0 ; i < iDevice.length ; i++ ) { | |
if( navigator.platform === iDevice[i] ){ | |
isIOS = true; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment