Skip to content

Instantly share code, notes, and snippets.

@tbeseda
Last active December 11, 2015 10:48
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbeseda/4589142 to your computer and use it in GitHub Desktop.
Save tbeseda/4589142 to your computer and use it in GitHub Desktop.
// Simple method to detect a mobile device
function isMobile(){
return (/iphone|ipod|android|blackberry/).test(navigator.userAgent.toLowerCase());
}
// Example usage:
if(isMobile()){
console.log('This is a mobile device.');
} else {
console.log('This is not a mobile device');
}
@argyleink
Copy link

nice, works great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment