在具有iPadO的iPad上区分iPad和Mac

zvi*_*zvi 6 user-agent ipad ios ios13 ipados

苹果在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移动版/ 7B314 Safari / 531.21.10

它成为(例如)

Mozilla / 5.0(Macintosh ; Intel Mac OS X 10_15)AppleWebKit / 605.1.15(KHTML,like Gecko)版本/13.0 Safari / 605.1.15

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

qua*_*ngh 8

我用来检测 IpadOS 的条件:

ua.toLowerCase().indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2
Run Code Online (Sandbox Code Playgroud)