Skip to content

Instantly share code, notes, and snippets.

@599316527
Created August 24, 2014 10:24
Show Gist options
  • Save 599316527/98be5cfc1e86e50b7f2d to your computer and use it in GitHub Desktop.
Save 599316527/98be5cfc1e86e50b7f2d to your computer and use it in GitHub Desktop.
Detect Mobile Devices
/**
* Detect whether the device is mobile device
* @type {Boolean}
*/
function detectMobileDevice() {
return (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
}
window['isMobileDevice'] = detectMobileDevice();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment