Created
January 29, 2014 16:20
-
-
Save ckng/8691468 to your computer and use it in GitHub Desktop.
snippet: quick simple way to detect mobile device
This file contains hidden or 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 simple way to detect mobile device | |
function is_touch_device() { | |
return !!('ontouchstart' in window) // works on most browsers | |
|| !!('onmsgesturechange' in window); // works on ie10 | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment