Created
May 4, 2021 15:10
-
-
Save victory-sokolov/5339b098f48f1f6ab98439a0f1d3e010 to your computer and use it in GitHub Desktop.
Check if user is on a 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
const isMobileDevice = (): boolean => { | |
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