Skip to content

Instantly share code, notes, and snippets.

@qwertypants
Created November 10, 2010 18:04
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 qwertypants/671232 to your computer and use it in GitHub Desktop.
Save qwertypants/671232 to your computer and use it in GitHub Desktop.
Check to see if the user is on iPad, iPod, or iPhone
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