Last active
January 10, 2017 20:11
-
-
Save Donmclean/3e872ef5b18bea4814665736d747aa54 to your computer and use it in GitHub Desktop.
Detects via javascript is client is mobile/tablet regardless of size. Will always return false on desktop browser.
Very Useful!
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
const isTabletOrMobileDevice = () => { | |
// return window.screenX === 0 || window.screenLeft === 0; //OLD | |
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment