Last active
May 24, 2018 12:47
-
-
Save dmjcomdem/d59cdc10623de4d04f6718d2fe65a2e7 to your computer and use it in GitHub Desktop.
Detects wether the website is being opened in a mobile device or a desktop/laptop.
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
const detectDeviceType = () => | |
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) | |
? 'Mobile' | |
: 'Desktop'; | |
detectDeviceType(); // "Mobile" or "Desktop" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment