在具有iPadO的iPad上与iPad和Mac进行区分

问题描述 投票:6回答:1

在iOS 13中,苹果更改了iPad使用的用户代理。

而不是(例如)

Mozilla / 5.0(iPad; U; CPU iPhone OS 3_2如Mac OS X; zh-cn)AppleWebKit / 531.21.10(KHTML,如Gecko)版本/4.0.4 Mobile / 7B314 Safari / 531.21。 10

例如(变成)

Mozilla / 5.0(Macintosh;英特尔Mac OS X 10_15)AppleWebKit / 605.1.15(KHTML,例如Gecko)版本13.0 Safari / 605.1.15

我的问题是我们现在如何区分iPad和Mac?

ios ipad user-agent ios13 ipados
1个回答
0
投票

我用来检测IpadOS的条件:

ua.toLowerCase().indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2
© www.soinside.com 2019 - 2024. All rights reserved.