Created
December 26, 2014 21:20
-
-
Save bgaeddert/120742b3ed09ead8c44c to your computer and use it in GitHub Desktop.
Tests if browser is mobile
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
| /** | |
| * | |
| * Tests if browser is mobile | |
| * | |
| * @returns {boolean} | |
| */ | |
| function isMobile() { | |
| if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { | |
| return true; | |
| } | |
| return false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment