Last active
December 17, 2020 17:57
-
-
Save directionforward/ae863954e7d7c2d9768a2eb7fb2fcfd5 to your computer and use it in GitHub Desktop.
Quick user agent identify
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 userAgent = navigator.userAgent.toLowerCase(); | |
console.log(userAgent); | |
const isTablet = /(ipad|tablet|(android(?!.*mobile))|(windows(?!.*phone)(.*touch))|kindle|playbook|silk|(puffin(?!.*(IP|AP|WP))))/.test(userAgent); | |
console.log(isTablet); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment