Created
August 25, 2020 13:06
-
-
Save anehkumar/328f488f81dc584c1dee92d10e143312 to your computer and use it in GitHub Desktop.
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
<script> | |
var isMobile = false; | |
if (navigator.userAgent !== undefined) { | |
var userAgent = navigator.userAgent.toLowerCase(); | |
var iPhoneIndex = userAgent.indexOf("iphone"); | |
var iPadIndex = userAgent.indexOf("ipad"); | |
var isIPhone = (iPhoneIndex !== -1 && iPadIndex === -1) || (iPhoneIndex !== -1 && iPhoneIndex < iPadIndex); | |
var isAndroid = userAgent.indexOf("android") !== -1 && userAgent.indexOf("mobile") !== -1; | |
var isOtherMobile = userAgent.match(/^.*?(ipod|blackberry|mini|windows\\sce|palm|phone|mobile|smartphone|iemobile).*?$/) != null; | |
isMobile = isIPhone || isAndroid || isOtherMobile; | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment