ua-parser-js icon indicating copy to clipboard operation
ua-parser-js copied to clipboard

iPad user agent is identified as mobile

Open rluttikhuizen opened this issue 2 years ago • 0 comments

Hello,

We use react-device-detect to determine if our app runs on a tablet or mobile device. react-device-detect uses ua-parser-js as parser.

When we run our Ionic React app on an iPad 8th gen with iOS 14.6, the user agent is Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148.

In this case the getDevice() method returns mobile as type. This causes react-device-detect to identify the platform as mobile (unexpected result).

In a demo project we stub the user agent as Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) (so without the Mobile/15E148). Now the getDevice() method returns undefined. Based on other information, react-device-detect is able to determine that we run on a tablet (expected result).

The result I expected was that the user agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 would be interpreted as undefined, just like Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko).

Kind regards,

Ronald

rluttikhuizen avatar Nov 04 '21 14:11 rluttikhuizen