在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?
我用来检测IpadOS的条件:
ua.toLowerCase().indexOf('macintosh') > -1 && navigator.maxTouchPoints && navigator.maxTouchPoints > 2