Skip to content

Instantly share code, notes, and snippets.

@gregkepler
Created October 22, 2014 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregkepler/5691453af088d8192112 to your computer and use it in GitHub Desktop.
Save gregkepler/5691453af088d8192112 to your computer and use it in GitHub Desktop.
Snippets for detecting if browser is on an android or iOS device
// 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