mozilla-mobile / firefox-ios

Firefox for iOS
Mozilla Public License 2.0
12.14k stars 2.91k forks source link

iPad: browser out-of-date warnings on reddit, bankofamerica #6310

Closed garvankeeley closed 4 years ago

garvankeeley commented 4 years ago

https://www.reddit.com https://www.bankofamerica.com

Both have user agent detection problems

porsche613 commented 4 years ago

I think these issues are triggered by the same bug which using a UA string FxiOS instead of a standard Firefox UA strings like Firefox Mobile before:

webcompat/web-bugs#49715 -> mozilla-mobile/firefox-ios#6291 (possible solution) and webcompat/web-bugs#49719

athomasmoz commented 4 years ago

Because we're seeing this on so many sites, let's change the User Agent for all sites. Need to determine whether it makes sense to use Firefox Desktop UA or Safari UA. Worth investigating what Safari does and what Chrome does.

athomasmoz commented 4 years ago

List of sites where this happens

Vest commented 4 years ago

These websites do not like the user agent. Currently it is detected as:

Firefox on iPad
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/24.1 Safari/605.1.15

And this web site suggested me to update Firefox to 74. Chrome is detected properly:

Chrome on iPad
Mozilla/5.0 (iPad; CPU OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/80.0.3987.95 Mobile/15E148 Safari/604.1

According to Firefox docs, the user agent string for iPad should be different:

Mozilla/5.0 (iPad; CPU iPhone OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) FxiOS/1.0 Mobile/12F69 Safari/600.1.4

I use iPad Pro (12.9-inch) (2nd generation), MQDA2FD/A; 13.4.

The same websites work fine on iPhone 8 Plus with the user agent string:

Mozilla/5.0 (iPhone; CPU OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/24.1 Mobile/15E148 Safari/605.1.15
Vest commented 4 years ago

It seems interesting, but I have found that there were fixes in the past, where some websites were put into a special exclusion list. E.g. this commit: b966a58

@nbhasin2, may I ask you to look at this issue? Is there a better solution (e.g. more generic) to prevent it from happening again and again? iPhone version of Firefox works well, but iPad tells that it has Macintosh with Intel CPU.

Thanks

porsche613 commented 4 years ago

It seems the problem not cause by UA string FxiOS .

The string Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15) and FxiOS appears in the same time, could confuses some websites that how to recognize what type of devices and what type of contents should be send back, I have tested on Firefox and Brave for Windows/Linux/macOS with UA switching extensions, the bug can be reproduced.

Maybe the UA string:

Mozilla/5.0 (iPad; CPU OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) FxiOS/24.1 Mobile/15E148 Safari/605.1.15

is a good choice.

And, the UA of MS Edge for iOS:

Mozilla/5.0 (iPhone; CPU OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 EdgiOS/45.2.16 Mobile/15E148 Safari/605.1.15

as the Mozilla docs recomended.

However, some website still send back their mobile site contents with the 2 UAs ( https://item.jd.com/30325385112.html memtioned in https://github.com/webcompat/web-bugs/issues/49719 e.g.), so I have also checked the UA of Safari for iPad(iOS) when set to force desktop site, it's using the UA of Safari for macOS:

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

Maybe using the UA of Firefox for macOS is the ultimate choice...XD

Vest commented 4 years ago

@porsche613, I don’t know if it is easy to build Firefox from the source code, but I can give it a try, and experiment with different UA strings. I don’t think that it is a good choice to use the current UA for Mac, because the first web site that I found (https://www.whatismybrowser.com/) simply told me that my browser is outdated. It detected the version 24.1 Mac (Catalina), and suggested me to update it to 74.

The mobile version of the page (when you request a mobile version explicitly) works fine. Maybe the servers don’t like 24, thinking that the browser is very old.

nbhasin2 commented 4 years ago

Hi @Vest It is actually straight forward to build Firefox iOS. Let me know if you encounter any issues. Requirements: XCode 11.4 Command:./bootstrap.sh

Thanks @porsche613 for doing the primarily investigation. We haven't made a final decision yet on what UA string to use. Next steps would be do more investigation on what UA string works best with most websites.

Feel free to ping us on Riot if you have any issue(s) and want to discuss https://github.com/mozilla-mobile/firefox-ios/wiki/Firefox-iOS-contribution-(Starter-Guide)

Jimbolino commented 4 years ago

I've had some problems on an ipad with IOS 12. Because webkit on IOS12 has a bug with "same site secure" cookies: https://www.chromium.org/updates/same-site/incompatible-clients

Firefox identifies itself as "Mac OS X 10.15", which is the version that actually doesnt have the bug anymore.

cscgh commented 4 years ago

For a quick fix, I just pushed my local changes to my github fork, particularly, UserAgent.swift, (https://github.com/cscgh/firefox-ios/commit/d3ddd3899ad98907e280a4ff3104eaa816ec31ab) to mimic Safari on desktop User-Agent 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.

I use it to finally get WhatsApp, web.whatsapp.com on my iPad. I also went ahead and checked it against bankofamerica.com and paypal.com. I wasn't having reddit problems to begin with but I rarely visit.

I built with XCode 11.4 beta 2 with local app services and run on iPad Air 3 and Mini 4 running iOS 13.4.

garvankeeley commented 4 years ago

Assigned myself to put in a quick-fix for this for v25 to just return the Safari UA. There are likely better long-term fixes.

SimonBasca commented 4 years ago

Verifying as fix on 25.0 (17793) for : https://www.reddit.com https://www.bankofamerica.com

porsche613 commented 4 years ago

Verified after 25.0 fix on iPad Air 3 w/ iPad OS 13.4.1: https://item.jd.com/30325385112.html in https://github.com/webcompat/web-bugs/issues/49719 https://www.zhihu.com/topic/19676719/hot in https://github.com/mozilla-mobile/firefox-ios/issues/6291 They work OK.