Created
November 10, 2010 18:04
-
-
Save qwertypants/671232 to your computer and use it in GitHub Desktop.
Check to see if the user is on iPad, iPod, or iPhone
This file contains hidden or 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 iCheck(func){ | |
if (!(navigator.userAgent.match(/iPhone/i)) || !(navigator.userAgent.match(/iPod/i)) || !(navigator.userAgent.match(/iPad/i))) { | |
func(navigator.userAgent); | |
} | |
} | |
// Usage | |
iCheck(function(agent){ | |
// You can use a case select statement to | |
// evaluate what actions you want to do | |
alert(agent); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment