Created
August 24, 2014 10:24
-
-
Save 599316527/98be5cfc1e86e50b7f2d to your computer and use it in GitHub Desktop.
Detect Mobile Devices
This file contains 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
/** | |
* 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