ngx-device-detector icon indicating copy to clipboard operation
ngx-device-detector copied to clipboard

iPad (6th Generation) v14.0.1 not correctly recognized

Open ajafff opened this issue 4 years ago • 9 comments

Using [email protected]

Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15 Firefox Daylight 29.1: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15

Both give the following results:

device: Unknown, expected iPad deviceType: tablet os: Mac, expected iOS browser: Safari (that's fine for me to not be able to distinguish between Safari and Firefox)

works on Chrome: Mozilla/5.0 (iPad; CPU OS 14_0 like Max OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/86.0.4240.93 Mobile/14E148 Safari/604.1 Edge: Mozilla/5.0 (iPad; CPU OS 14_0_1 like Max OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 EdgiOS/44.11.15 Mobile/14E148 Safari/604.1.15

ajafff avatar Dec 04 '20 13:12 ajafff

Idea for a possible solution: It seems like you cannot get the information from the UserAgent. IIRC you can distinguish iPad and Mac by checking for multi-touch support (iPad has it, Mac doesn't): https://stackoverflow.com/a/58979271

ajafff avatar Dec 04 '20 13:12 ajafff

Hey @ajafff . Thanks for reporting this with the details 👍 We're already checking the touchpoints in our code. However, I see that we might not be having the platform set to MacIntel maybe, otherwise it should work actually. Did you test this on a real device or simulator or chrome emulator? If you can, feel free to raise a PR. If not, I'm probably gonna look into this soon 🙂

AhsanAyaz avatar Dec 05 '20 13:12 AhsanAyaz

This was tested on a real device.

I tried to contribute a fix. Unfortunately I don't understand what's going on in the code. For example, I don't know how the condition on line 72 could ever be true.

ajafff avatar Dec 05 '20 13:12 ajafff

Ahan. I'm gonna see if this is the same on my iPad 2. If it isn't the same, then wouldn't be able to test it unfortunaly.

AhsanAyaz avatar Dec 05 '20 18:12 AhsanAyaz

I see that we might not be having the platform set to MacIntel

I just tested that. navigator.platform is actually set to iPad

ajafff avatar Dec 07 '20 08:12 ajafff

@ajafff then that's the cause. We can add this to the code then. I'm gonna try to get it done and released soon. Feel free to share a PR if you got time. I'll do it otherwise as soon as possible.

AhsanAyaz avatar Dec 07 '20 16:12 AhsanAyaz

Is it done !! Would love to work on it..

sumitgsh avatar May 03 '21 13:05 sumitgsh

Hey @sumitgsh . Not yet. Feel free to raise a PR if you're interested.

AhsanAyaz avatar May 03 '21 14:05 AhsanAyaz

text

ngtanthanh avatar Feb 28 '22 03:02 ngtanthanh