Skip to content

Instantly share code, notes, and snippets.

@ericrallen
Created August 1, 2012 18:16
Show Gist options
  • Save ericrallen/3229434 to your computer and use it in GitHub Desktop.
Save ericrallen/3229434 to your computer and use it in GitHub Desktop.
JavaScript UA Checker, modified from http://bit.ly/nMEXh4 to represent ipad, as well.
//check for mobile devices
//modified from http://bit.ly/nMEXh4
var ua = navigator.userAgent;
var checker = {
iphone: ua.match(/(iPhone|iPod)/),
ipad: ua.match(/(iPad)/),
blackberry: ua.match(/BlackBerry/),
android: ua.match(/Android/)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment