Created
June 30, 2011 07:26
-
-
Save FiNGAHOLiC/1055801 to your computer and use it in GitHub Desktop.
Detect apple 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
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