How do websites on iPadOS still detect a mobile browser?

On my iPad I tried going to mlb.tv to watch a baseball game, but even though my setting is to request the Desktop website, MLB still throws up this webpage insisting I use the mobile app to watch the game. How does MLB know I’m on an iPad vs Mac?

The website can detect your screen size.

This is true, but it’s not how they’re doing it. Otherwise you could run the same website on a Mac with a viewport the size of an iPad and get the iPad version. That’s not the case.

The browser is probably using a bit of JavaScript to “sniff” the user agent of the device, or check for touch screens. (There are a few ways to skin this cat, or they could be combining methods for more accuracy.)

Requesting the desktop version of a website is a different thing. Don’t quote me on this, but my understanding is that it’s meant for websites where mobile CSS is present, but you want a desktop view. This should have no effect on a responsive website, but if you’re on the “mobile website” and want “the desktop website,” and those exist separately, you can request the desktop one.

1 Like

I’m with you — this is so frustrating and is one of the things that keeps the iPad from being a Mac replacement for me. The browser. Let me surf the web as I would on my MBP!

Yeah, I find it frustrating that websites are trying to control my behavior just because I choose to use an iPad vs a Mac. Why do I have to use your damn app? I don’t know if there is more Apple can do to give users back control over how they use their browser.

Same situation as you, and it drives me nuts. i assume it is looking at OS. The app is okay since I use PiP most of the time, but let me make that choice!

Now I’m confused. AFAIK, I never get mobile web sites when I use my iPad. I just went to mlb.tv on my iPad, and my Mac, and got the same pages.

When I log into Gmail with Safari on my iPad the security notice says “We noticed a new sign-in to your Google Account on a Mac device.” So Google is apparently honoring my settings.

If we both have Settings/Safari/ Request Desktop Website/ turned on for all websites why do we get different pages?

1 Like

If I understand @snelly correctly, they may not be trying to force you to do anything. Breaking down his explanation (I think):

Some sites have separate mobile and desktop versions. If they detects mobile browser they give you that version, and vice versa. Then requesting the desktop version gives you the “wrong” version, as you request, by misleading the server into thinking you’re using a desktop browser rather than a mobile browser. (No judgment – I do this a lot.)

However, not all websites work that way. Some sites have a single version, with a “responsive” layout and structure. These sites are set up in such a way that they rearrange themselves based on the size, resolution and shape of your screen. So sidebars hide or show or flow to different places depending on the screen – and there is no separate “desktop” version to provide when you request it. You’re getting the only version there is for the screen you’re using.

This makes a lot of sense to me, and solves the long running mystery of why it doesn’t always work to request a desktop site. Thanks, @snelly!

I suppose it might be possible to fool the server into thinking your screen is a different size and resolution than it is, but I think Apple might have to build that functionality in (or maybe a browser maker can do it? Not sure).

1 Like

Same issue with “m.facebook.com” - so frustrating to get this loaded on the iPad. Not that I use it enough to really care anymore :slight_smile:

So I turned off the “Request Desktop Website” to see what would happen. I still get the page I posted above. So they are doing something to detect I’m running on an iPad regardless of that setting.

With each request, your browser sends a user agent string in the request headers. That string will identify the browser, version, platform (operating system), etc. Mobile browsers will include “Mobile” in the string to indicate that they should be sent the mobile version of the site. When you have the Request Desktop Site option enabled, all Safari does is not include “Mobile” in the string. However, it still lists iPad OS as the platform.

Therefore, some sites will ignore the presence (or lack thereof) of the “Mobile” string and simply look at the platform. When they see iPad OS, they will serve up their mobile site, ignoring your preference. In some browsers you have been able to get extensions which alter the User agent String to trick sites into returning a different version of their site. However, I’ve never seen such an extension for Safari and I expect Apple wouldn’t actually allow such an extension.

As @snelly and @tf2 explain, other sites will ignore the User Agent string completely and provide the same responsive site to everyone, in which case the layout is affected only by the size and orientation of the viewport. However, those sites are not the ones anyone is complaining about here.

But so far we are only talking about sites which (mostly) follow the rules. A number of years ago, it became popular to alter your user agent string in various ways to get what you wanted. Sites which didn’t want to give us that control wised up to those tricks and no longer trust user agent strings. They will use JavaScript to check various variables and attributes which are known to have unique values per system and use that to identify which browser and/or platform you are on. There is nothing you can do to trick these sites. You get what they give you.

In the case of mlb.tv (or any video streaming site), it is likely that there are legal implications in serving you content which is not licensed for that platform. Therefore, legally, they are required to serve you the “Mobile” version as they do not have a license to serve you any other version when you are using a mobile device. In other words, the site developers are required by the company lawyers to use the tricks described above to ignore your preferences and force the mobile version on you. Of course, the lawyers are simply ensuring that the organization is complying with the contracts that they have entered into. In this case, if you want to blame anyone, blame whoever thought that video should be licensed separately depending on which platform it is being viewed on.

1 Like

Use iCab. It has way more options to manipulate the User Agent than Safari.

1 Like

Seconded. This has been the only desktop-class browser on iOS for like a decade to my knowledge. I used to use it when I wanted Firebug Lite, or actual scrollbars, or proxy settings, or to download some audio/video off a page. I feel like many of the features it has implemented over the years it has only been able to get away with because it’s relatively unknown.

The problem is I don’t like iCab and enjoy the syncing with Safari. But you are right, in a pinch it works.

I tried it and changed the Browser identity to several different ones including Chrome and Windows 10, but I always get the same page.

I checked on a web server that I run and the user agent string for my iPad and Mac Safari are the same.

1 Like