react-device-detect icon indicating copy to clipboard operation
react-device-detect copied to clipboard

Chrome is being detected as Safari in iPad

Open Hamdan85 opened this issue 4 years ago • 9 comments

  1. isSafari or isMobileSafari returns true when running chrome in iPad 2020 (probably others too)
  2. Get iPad 2020, open chrome and render the check
  3. iPad Pro 2020 with chrome.
  4. iPad Pro 2020 with Chrome

My app shouldn't run in safari so I do this check:

const isBrowserSupported = !isSafari && !isMobileSafari;

and it returns true in chrome on iPad Pro 2020

Hamdan85 avatar Dec 21 '20 14:12 Hamdan85

@Hamdan85 Please provide iPad Pro 2020 user agent

duskload avatar Dec 22 '20 06:12 duskload

@duskload man, I'm sorry but I'm not sure what you mean... Isn't it Chrome?

I'm sorry but if you want the console user agent, I won't be able to give you because it happens in BrowserStack (but it's also reproducible in all customers hardware)

Can I help? Please tell me exactly what you need and I'll fetch it for ya ;)

I've read that chrome used to run on safari's webkit but I guess this is past right? Or not?

Hamdan85 avatar Dec 23 '20 02:12 Hamdan85

@duskload check this out.. I managed to get the user agent that causes the issue:

image

Mozilla/5.0 (iPad; CPU OS 14_- like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/86.0.4240.93 Mobile/15E148 Safari

Hamdan85 avatar Dec 23 '20 20:12 Hamdan85

Chrome on iOS is just a decoration around the iOS webView. When it comes to supported features and the JS engine, Chrome on the iPad is Safari (just even a little bit more restricted).

DoubleMalt avatar Mar 08 '21 13:03 DoubleMalt

well... respectfully, but this is common knowledge. we know that.

but, in order for the library to attend its purpose, it should differentiate them anyway, right? maybe I'm wrong about it, but it feels to me that it should.

Otherwise, why it differentiates between chrome and edge?

Hamdan85 avatar Mar 08 '21 15:03 Hamdan85

My apologies, I did not want to imply that you don't know this.

However it seemed from your use case it seemed that you cannot support Safari on iOS because of missing features. It would follow that you cannot support Chrome on iOS either. So detecting iOS would be enough to tell you that you cannot support the browser.

From the UA you sent it also seems like Chrome on iOS announces itself as Safari.

DoubleMalt avatar Mar 08 '21 15:03 DoubleMalt

Safari has limitations that would make it problematic to identify it as Chrome. I.e. Safari doesn't support a lot of SVG stuff, while all the other browsers support SVG fully.

If you want to detect Safari to display PNG instead of SVG as an alternative, that works well. If Chrome on iPad gets served an SVG, it will not display it properly, and Safari is the correct detection here.

Guess this isn't true for all cases though.

hnilsen avatar Mar 23 '21 18:03 hnilsen

Hi guys, we're experiencing the same problem on this device:

Browser name: Chrome Browser version: 87.0.4280.163 User Agent: Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/87.0.4280.163 Mobile/15E148 Safari/604.1 Operating System: iOS 14.4

Any thoughts on how to sort it?

Thanks

guillo-crikle avatar May 22 '21 10:05 guillo-crikle

It's certainly possible to identify Chrome on iOS. Check other tools like https://www.whatsmyua.info . Chrome includes a unique segment (like CriOS/87.0.4280.163) in its user-agent string. It would be great if react-device-detect was extended with Chrome/Firefox support of their iOS apps.

pranas avatar Oct 18 '21 12:10 pranas