()
| 1 | import { isDesktopWebKit, isIPad, isWebKit } from '../utils/browser' |
| 2 | |
| 3 | export default function getPlatform(): string { |
| 4 | // Android Chrome 86 and 87 and Android Firefox 80 and 84 don't mock the platform value when desktop mode is requested |
| 5 | const { platform } = navigator |
| 6 | |
| 7 | // iOS mocks the platform value when desktop version is requested: https://github.com/fingerprintjs/fingerprintjs/issues/514 |
| 8 | // iPad uses desktop mode by default since iOS 13 |
| 9 | // The value is 'MacIntel' on M1 Macs |
| 10 | // The value is 'iPhone' on iPod Touch |
| 11 | if (platform === 'MacIntel') { |
| 12 | if (isWebKit() && !isDesktopWebKit()) { |
| 13 | return isIPad() ? 'iPad' : 'iPhone' |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | return platform |
| 18 | } |
no test coverage detected
searching dependent graphs…