iphones

Detecting iPhones in desktop mode for iOS 17

Data Team

9/11/2023 1:30 PM

Apple Device Detection iOS iPhone User Agent Device Data

We’ve spotted a subtle difference that could impact other device detection solutions

Every September, Apple release new iPhones, iPads, and an update to the iOS operating system. We’ve already updated our Apple device detection to support iOS 17 and we eagerly await the new devices.

When playing with the preview version of iOS 17, we spotted a small change. It may break detection solutions that do not distinguish between different iPhone display modes.

iPhone desktop mode User-Agent

The Apple User-Agent string is complicated. The device model isn’t included in the string, and iPhones and iPads can pretend to be a desktop Mac.

For example, an iPhone user can activate “desktop mode” which requests the desktop version of a website, rather than the mobile one.

Doing this changes the User-Agent for that device. Here’s a User-Agent of an iPhone 13 using iOS 15.4 and Safari in default mode:

Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1)

Whereas the same iPhone 13 in desktop mode is:

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

For comparison, an actual desktop Mac with Safari User-Agent looks like:

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

What has changed with iOS 17?

Apple iOS 17 deviates from the past User-Agent pattern. From the iOS 17 preview, we can see the “Mac OS X” version is now frozen at 10_15_7.

This part of the User-Agent string can no longer be used to help detect the Apple device if it is in desktop mode. Instead, we must look to the “Version/” information in the string. Let's look at some iPhone User-Agents to visualize this change.

Here’s the User-Agent of an iPhone 13 using iOS 15.4 in desktop mode:

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

And an iPhone 13 using iOS 16 in desktop mode:

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

Finally, here is an iPhone 13 using iOS 17 in desktop mode:

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

Notice how both the Mac OS X version (in orange) and the major iOS version (in purple) increase incrementally – up until the pattern changes with iOS 17. The Mac OS X version is the same across both the iOS 16 and iOS 17 User-Agents.

What does this mean?

The User-Agent alone cannot be relied upon for Apple device detection. We use JavaScript to enhance the detection results. We also test iOS updates on actual iPhones, so there’s no chance for fake or assumed data. All of this results in increased Apple iPhone device detection accuracy.

Apple likes to keep the industry on their toes. Our customers can rest assured that we do everything we can to ensure high quality device detection results for Apple devices.