
Show HN: Detect which iOS devices are used on your site - dieulot
https://www.dieulot.fr/idevice
======
valgaze
Not device-type, looks famous.co can infer battery mode from Safari:
[https://imgur.com/a/XvAGvWS](https://imgur.com/a/XvAGvWS)

~~~
dieulot
They’re trying to autoplay a video, which Safari blocks if the device is in
low power mode. [https://pastebin.com/xxN2VPi4](https://pastebin.com/xxN2VPi4)
Nice find!

------
jrockway
Why include the lookup table in the client code? If you're just mapping (CPU,
resolution) to a model, why not just send that tuple to your analytics
framework and look it up when displaying? Doing the lookup on the client code
means every client has to download the table, and you have to blow away their
cached copy whenever you come up with an improvement in the mapping. Limiting
it to iDevices certainly makes this table smaller, but I feel like that's a
starting off point only... real websites are going to want data about other
platforms.

~~~
mygo
> Why include the lookup table in the client code?

maybe it’s a static site.

~~~
jrockway
The example was sending the data to Google Analytics, though.

~~~
krispbyte
Which reinforces the need to do the lookup in client code since you can't code
it into GA.

~~~
mygo
I mean you _could_ just get the data from the client that the lookup needs and
then send that data to your server for your server to do the lookup and then
return the result to the client

but maybe it’s a static site

------
Tepix
It recognized an iPhone X as iPhone 8 plus.

~~~
mygo
I visited it on an iPhone X and it did “Your device is an iPhone X” for me,
but I believe you. Not sure why you’re getting downvotes for reporting your
own actual user experience... especially on a Show HN... am I missing
something?

~~~
dogma1138
It seems that beyond the generation it tries to guess the rest based on the
screen res changing the font size and DPI via accessibility settings switches
between XS and XS max for me.

------
Sephr
There's also navigator.hardwareConcurrency which can tell you the number of
CPU threads available to a device.

Unfortunately, it looks like Apple caps this value to 2 on iOS for anti-
fingerprinting purposes.

~~~
Cyph0n
Sounds more like “fortunately” for iOS users...

~~~
Sephr
Fortunately for privacy; unfortunately for the performance of heavy webapps
that may need an accurate hardware.navigatorConcurrency value for CPU scaling.

~~~
dogma1138
How many heavy web apps that would need it actually run on an iOS device?

------
bestham
I recently wondered how the "Login alert for Mobile Safari on Apple iPhone 7
Plus"-email from Facebook could tell my what device I used to log in to the
html version of Facebook. They must be doing the same correlation between SOC
and screen size that is mentioned in the article.

------
monochromatic
I’ve long assumed that websites could tell what kind of device I’m using. Is
that not true?

~~~
bdibs
On my Google Analytics account, it shows Android mobile devices as their full
model names, but iPhones and iPads as just Apple iPhone/iPad.

I'm sure Google could still narrow it down using other factors, like screen
size, but they're not sharing that with Analytics users.

~~~
MonkeyDan
Android Chrome includes phone model in the user-agent.

------
snacktaster
pretty neat. what would be the best way for me to block this

~~~
threeseed
Would also recommend you file a bug at
[https://bugreport.apple.com](https://bugreport.apple.com).

This is linked directly to their internal bug tracker (Radar) so I can assure
you it will be read and triaged by an engineering or product manager.

~~~
jakobegger
And you might even get a message "Closed as duplicate" three months later...

------
terandle
Nice, could be useful when I’m trying to answer someones questions about their
phone remotely and they don’t know which one they have.

~~~
jbob2000
But realistically speaking, ad networks are going to add this to their code to
gather even more information about you.

~~~
cocoa19
To be honest, it would surprise me if they are not already doing this.

On a side note, when you install, launch and maximize TOR browser, you get a
warning advising you not to maximize it. Web servers/attackers can use max
screen size as an additional point to determine your identity.

~~~
LeoPanthera
That’s confusing. Wouldn’t it be better if everyone maximised their window? If
you have a random window size you have a much higher chance of it being
unique.

~~~
ChrisSD
The default TOR viewport size isn't random. It picks a multiple of 200x100,
with 1000x1000 as the maximum

------
AndrewKemendo
Man, I needed this last summer when I was doing a huge project. Glad someone
can benefit from it!

