Created
November 28, 2020 00:54
-
-
Save ivmirx/db026d4bc877b9e015f5c0292b882d91 to your computer and use it in GitHub Desktop.
Detect the most common platforms, including ipadOS
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
var is_windows = navigator.platform.indexOf('Mac') > -1; | |
var is_macOS = false; | |
var is_ipadOS = false; | |
var is_iOS = /(iPhone|iPod)/i.test(navigator.platform); | |
var is_Android = navigator.platform.indexOf('Android') > -1; | |
var is_Linux = navigator.platform.indexOf('Linux') > -1; | |
if (navigator.platform.indexOf('Mac') > -1) { | |
if (navigator.maxTouchPoints > 1) | |
is_ipadOS = true | |
else | |
is_macOS = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment