mozilla-mobile / firefox-ios

Firefox for iOS
Mozilla Public License 2.0
12.26k stars 2.95k forks source link

Expand static User Agent overrides to iPhones #16469

Open data-sync-user opened 1 year ago

data-sync-user commented 1 year ago

As per [~accountid:6048302caf98490072495aa2]' information from our chat in Montreal, Firefox for iOS has the ability to ship custom User Agent strings to specific websites on iPad, as per the implementation here.

To address some of the known Web Compatibility issues in iPhones, for example the video playback issue on nba.com, it would be good to have this ability expanded to the iPhone version. The WebCompat team would be happy to submit PRs for new UA overrides, but we can’t build the feature ourselves due to resource (and knowledge) constraints.

┆Issue is synchronized with this Jira Task

cpeterso commented 1 year ago

To start, we'd like to add UA overrides for the following sites that currently reject Firefox users on iPhone. We don't need to override the UA on iPads because Firefox on iPad uses a more desktop-like UA.

data-sync-user commented 1 year ago

➤ Stefan Vladut commented:

for testing this you should use a VPN to access http://therokuchannel.roku.com ( http://therokuchannel.roku.com|smart-link ) which is available in the USA, and check that videos can be played, while the nba.com ( http://nba.com ) videos can be tested without a VPN

data-sync-user commented 1 year ago

➤ Andrei Bodea commented:

I tried to verify this issue on v9000 (35359) with iPhone 13 Pro (15.7.1).

Please note that with a VPN I was able to check and everything works well on http://therokuchannel.roku.com ( http://therokuchannel.roku.com|smart-link ) but for nba.com the videos are not loading/playing.

!Video (2).mov|width=220,height=480!

I will set this issue to open until further notice.

data-sync-user commented 1 year ago

➤ Stefan Vladut commented:

When I reinvestigated the video issues with the nba.com ( http://nba.com/ ) website, I tested on safari, chrome, edge, brave, opera, on iOS 16 it doesn't work on any browser, on iOS 17 it works for me on all browsers the same as it does on the latest Firefox build, sometimes the video loads directly, otherwise you have to tap the skip 10 seconds fw/bw button for the video to start playing or starting the video as picture in picture. This doesn’t seem to be just a User Agent issue anymore, the core issue should be fixed by the website’s team.

data-sync-user commented 11 months ago

➤ Daniela Arcese commented:

Stefan Vladut is this issue done? I see a PR attached.

cpeterso commented 11 months ago

We no longer need this fix for nba.com or therokuchannel.roku.com (because nba.com doesn't work in Safari either https://github.com/mozilla-mobile/firefox-ios/issues/13294 and therokuchannel.roku.com has been fixed on their side https://github.com/webcompat/web-bugs/issues/126427)

But I see the PR also adds UA overrides for some mobile ad domains. I don't know why. Are those UA overrides still needed? If so, the PR should remove nba.com and therokuchannel.roku.com before merging.

https://github.com/mozilla-mobile/firefox-ios/commit/27c3cab7d186a76eae3c061e6534d0b6137dfb1a

data-sync-user commented 11 months ago

➤ Stefan Vladut commented:

Daniela Arcese Chris Peterson The short story for this ticket is this one: when I first worked on it I was able to make it work by adding the UA overrides to the mobile ad domains that were called before loading the videos on nba.com ( http://nba.com ). Not optimal, but it was working fine and was solving the issue, and afterwards nba.com ( http://nba.com ) changed the way the videos are served, added more/different mobile ads requests and what I did previously was no longer working by the time it was verified, adding the new domains was not fixing the issue either so I tested on the other browsers that were previously working and discovered that it’s broken everywhere with their changes. Should I remove the domains I added for the UA override for nba.com ( http://nba.com )?

cpeterso commented 11 months ago

Since we no longer need UA overrides for nba.com or therokuchannel.roku.com, then I don't think we will need the UA overrides for the mobile ad domains. In that case, I think you can close your PR without merging. What do you recommend? Are there any other sites that require UA overrides for the mobile ad domains?

I also worry that overriding the UA we send to mobile ad domains might cause new side effects on other sites or our mobile search revenue.

data-sync-user commented 10 months ago

➤ Stefan Vladut commented:

Chris Peterson I made a PR ( https://github.com/mozilla-mobile/firefox-ios/pull/18047 ) to remove the changes to the User Agent for those 2 websites as those changes were already merged to be able to be tested. Some other websites might have such restrictions but none were reported so far besides nba/roku, so we can deal with them when they’ll be detected as needing this type of change.