Last active
August 29, 2015 13:57
-
-
Save stormwarning/9413913 to your computer and use it in GitHub Desktop.
Quick & dirty browser sniff to 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
/** | |
* Quick & dirty browser sniff to detect mobile devices. | |
*/ | |
var isMobile = false; | |
if( navigator.userAgent.match(/Android/i) || | |
navigator.userAgent.match(/webOS/i) || | |
navigator.userAgent.match(/iPhone/i) || | |
navigator.userAgent.match(/iPod/i) || | |
navigator.userAgent.match(/iPad/i) || | |
navigator.userAgent.match(/BlackBerry/i) || | |
navigator.userAgent.match(/IEMobile/i) || | |
navigator.userAgent.match(/Opera Mini/i) | |
) { | |
isMobile = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment