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

I have a similar situation as antrix1989 where our webclient determines if a user is browsing via an iPad with JavaScript and alters/restricts the content. We can then market our clients to a subscription on/with our native iOS app. Would be super helpful if the User Agent stated it was iPad OS instead of Mac OS X:

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

so a regex match could be done to fairly certain determine a user was on iPad.


Hopefully this will change closer to or after the release?

Any update on this? Will the issue be solved before ios13 is released? I'm facing the same issue on iPads.


In our case we use the user agent to detect if the browser belongs to a mobile device.


This is important because on mobile devices we set our web application to listen the touch events such touchstart, touchend, etc, to drag some elements. But currently we cannot subscribe to those events since we cannot detect it is a mobile device.


Somebody in another forum suggested me to verify if Safari browser is not set to show the desktop version of the web site. I'll check that today. But I think this is still an issue because even if user agent is retrieved as the desktop device, mouse events are not being emulated by safari.

Update:


I opened Settings -> Safari -> Request Desktop Website -> All websites. That option is enabled by default. I disabled it and the proper User Agent is now displayed.


Mozilla/5.0 (iPad; CPU OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Mobile/15E148 Safari/604.1


IMO it should be disabled by default and if a user enables it a modal window should be displaying indicanting not all web sites will be supported properly. Or maybe you may consider to add the iPad word to the first user agent to allow us to detect if it is an ipad emulating safari desktop or enable mouse event emulation, because I think when it is released several websites will fail.

I have the same issue with one of our sites, we render certain functionality for mobile devices (ipad included) based on the user agent.


The workaround esteban26 suggested works, but it's not ideal if it's enabled by default, It would be great if Apple considers adding the iPad word, or any other identifier to the user agent string.

Agree this should be disabled by default. The current user-agent lies about both the OS and the chipset (Intel vs Arm)

I had submitted a request to add a User Agent change function similar to the Desktop. On my desktop, there are some enterprise web apps speicifally look at browser versions and break on the latest version even though the app would work perfectly fine. I've done this several times where I change the Safari user agent to Chrome or IE11 and apps function just fine. It's just one more thing that would release corporate users from a desktop.

We have same issue here, certain functinalities are dependent on iPad word as well. I also expecting also Apple added back iPad or other keyword to identify iPad.

Hi..

I have a similar situation.

Any solution or update ?


Thanks

Again we need some way of determining an iPad

FYI, I submitted feedback/bug report via the Feedback app on the iPad back on July 3rd, 2019. Apple responded on the 19th wanting specific details/steps on how to reproduce the error... I gave specific steps on how to view the user agent via the safari developer console and have yet to hear back from them. The feeback app is reporting "More than 10" recent similar reports and the resolution is still "Open".


Starting to think they're not concerned about this.

Hopefully it will be resolved before launch.


This will impact thousands of our users 😟

Any news on this?

This is a problem for one of our application which is provided for major clients.

Would there be any meta tag which if present by default will launch the site in mobile?


Anyone else have any update on this?

Hi Antrix1989,

from what I've observed another way to load a mobile version of a given website on iPadOS is to ensure that the browser's width is compact. To achieve this you must use the multi-tasking feature and place safari in a popup or split paned with another app such that Safari now has compact width.


Neal

This doesn't work for me running iOS 13.1.2 on iPad. I turned "Request Desktop Website On All Websites" OFF and UserAgent still reports "Macintosh".


Is there something obvious I'm missing here? I am shocked this isn't causing complete chaos with all the web apps out there.

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?

User Agent in Safari on iPadOS
 
 
Q