User Agent in Safari on iPadOS

During authentication flow in Safari, we have a case when in order to satisfy a condition policy, user needs to install the app on his device. Depending on the OS, we ask him to install different applications. Since on iPadOS User Agent in Safari is same as on MacOS Catalina, what is recommened way to distinguish OS on server side?


iPadOS:

Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15


MacOS Catalina:

Safari: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Post not yet marked as solved Up vote post of antrix1989 Down vote post of antrix1989
77k views

Replies

I'm starting to wonder if 'iPadOS' is code for Catalyst.


After all, we're told we can build one app for mac and ipad...where is the bifurcation to help websites deliver their mobile-centric version?

Now that ios13 is out of Beta and deployed does anybody else still see the UA issue for Safari

Is there any fix on the horizon - We can't ask the entire Safari iPad using internet to know about and toggle this Dev tools fix

I can't believe they set this option to default on iPads, from minimal testing it's the Safari and Firefox browsers on iPads that default to "Desktop View" (Chrome still defaults to mobile website on ipads) and no one is offering a way for developers to get around this.


I collapse my menus on mobile devices and remove/add certain elements that are different from my desktop site and this completely destroys all of that coding.

This is still an issue.
Yes, the Desktop settings workaround does help get a sensible userAgent, but nobody on a large iPad is ever going to set that.
The main issue I have is that I'm developing an HTML5 Audio player where we want to hide our volume control interface when the device is an iPhone or iPad, since there is no way to control HTML5 Audio volume property via Javascript on these devices.
Does anyone have a sane solution to this?

OK I have a solution.


Simply create an HTML5 Audio object and attempt to set the .volume property.

Mobile Safari can't do this.


You're welcome.

Agreed. This is a devasting user experience for the iPad. And you want people to choose an iPad over a Mac and you make completely stupid moves like this? For example, iPadOS does not auto-uncompress .zip files like a Mac. Users come on the support saying how nothing works, because when they tap the download it's broken. Even sophisticated users have to poke around to find "Uncompress" buried at the bottom of the the long-touch menu. If you didn't LIE to my web server, I could offer the uncompressed link, and everything would be fine.


Do not LIE about your user-agent, certainly CPU architecture and operating system. That is the kind of schmuck moves the old Microsoft would make. Perhaps they hired the MSIE team. So short sighted. *** Apple?

Looking at the navigator object in Safari for iOS 13.6 there is a maxTouchPoints property,

iPad
navigator.maxTouchPoints returns 5

Desktop
navigator.maxTouchPoints returns 0

I'm not sure how far back the maxTouchPoints property goes, but checking this property exists and if so whether it has a value greater than 0 could be a work-around.
Wild that they would convince the site that you’re on a desktop without having the full functionality of a desktop browser I.e. setting the volume of a audio element via js

Hi, so it looks like User Agent "sniffing" will no longer work for iPad iOS 13+. If you have control over the devices, you could turn off the setting "Request Desktop Website" (Settings -> Safari -> Request Desktop Website (under Settings for Websites), but...
I'm assuming you don't have control over the client device settings.

Fix:

I did find this fix Repeated link if the embedded one doesn't work:
(https://stackoverflow.com/questions/9038625/detect-if-device-is-ios).

Essentially, just tack on the solution to whatever current User Agent detection you are running.

(copied below in case the answer is lost on Stack)

function iOS() {
  return [
    'iPad Simulator',
    'iPhone Simulator',
    'iPod Simulator',
    'iPad',
    'iPhone',
    'iPod'
  ].includes(navigator.platform)
  // iPad on iOS 13 detection
  || (navigator.userAgent.includes("Mac") && "ontouchend" in document)
}

Maybe Apple specifically wants iPadOS users to experience desktop websites by default, so they made its default user agent look like it's macOS?

They want people to think that the iPad is equivalent to a desktop browsing experience, even though it's not, but of course they don't care about web developers, only apps. If people complain about sites not working well with the iPad Apple can say it's the site's fault and their sheep customers believe anything they say.

I have the same issue. Could the Apple developer give some solution or update ?