MCPcopy
hub / github.com/fingerprintjs/fingerprintjs / getPlatform

Function getPlatform

src/sources/platform.ts:3–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { isDesktopWebKit, isIPad, isWebKit } from '../utils/browser'
2
3export 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}

Callers 1

platform.test.tsFile · 0.85

Calls 3

isWebKitFunction · 0.90
isDesktopWebKitFunction · 0.90
isIPadFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…