I've created a tool called detect-apple-device that attempts to identify Apple devices by analyzing window.screen.width and window.devicePixelRatio. However, many Apple devices have the same specifications; for instance, the iPhone 15 and the iPhone 14 Pro both match at 393×852@3x. I'm looking for other browser APIs that might help me distinguish between different models more accurately, since Apple doesn't include specific device info in their User-Agent strings. Are there any other options available?
4 Answers
You might want to consider using the Client Hints API, though I've never tried it myself. It could offer some additional details, but keep in mind it might require user permission for the more detailed info. It’s worth a shot!
To be honest, Apple doesn't want websites to accurately distinguish between their devices. They’re working against that kind of tracking, so outside of screen resolution, your options are pretty limited. Checking for quirks or bugs in Safari might be one of the better paths to take!
Sometimes, feature detection is just not feasible! I’ve faced crashes in Safari when attempting to access certain APIs that seemed supported. That’s a real headache for developers!
Imagine the day when we have an API that provides actual device information. That would open up so many possibilities for advertisers to refine their targeting based on device types and possibly income levels too!
