Skip to content

Instantly share code, notes, and snippets.

@FiNGAHOLiC
Created June 30, 2011 07:26
Show Gist options
  • Save FiNGAHOLiC/1055801 to your computer and use it in GitHub Desktop.
Save FiNGAHOLiC/1055801 to your computer and use it in GitHub Desktop.
Detect apple device
function isAppleDevice(){
var apple = {};
apple.ua = navigator.userAgent;
apple.device = false;
apple.types = ['iPhone', 'iPod', 'iPad'];
for (var i = 0; i < apple.types.length; i += 1) {
var t = apple.types[i];
apple[t] = !!apple.ua.match(new RegExp(t, "i"));
apple.device = apple.device || apple[t];
};
return apple.device;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment