3
votes

when I use ipad on chrome the useragent is

Mozila/5.0(iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1 (KHTML,like Gecko) CruiOS/57.0.2987.137 Mobile/13G36 ....

but ipad on safari is

(Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15

And MacOS useragent is

Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Problem : Since on iPadOS User Agent on Safari is same as on MacOS notebook following https://forums.developer.apple.com/thread/119186

and I this issue of Mobile_Detect php library https://github.com/serbanghita/Mobile-Detect/issues/795

1
Yes, same issue, user agent on iPad(iOS14) is useless when trying to detect mobile Safari browser. it is reported as mac os (not as ipad anymore) Safari. Same thing is happening with Firefox on iPad. I can only detect Chrome b/c it shows up as Mobile Chrome.Boris Gafurov

1 Answers

3
votes

To detect iPads, try this:

let isIpad = /Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints > 1;