+ 4
How do websites obtain details about the device accessing the site?
This usually happens when an ad pop up tells me my "Galaxy J500.." is due for updates (and other phishing/pharming attempts) or when I'm on my PC and can download files that my phone can't. How does the website know whether or not my device is compatible for the download? Which language do sites like CNET use to achieve this task?
2 Réponses
+ 5
1. How do websites obtain details about the device accessing the site?
a. Your browser sends a customizable* HTTP header.
b. Local storage, like cookies. Ad networks share data, so if one knows and they share cookies, they all know.
c. Fingerprinting methods (advanced topic), etc.
2. ...or when I'm on my PC (they seem to remember)
...because they do remember. Profiling is relatively easy and metadata only takes a little longer.
Storing data about devices that visited from your network is trivial.
3. How ... know my device is compatible?
Because "big data". For example, now you can purchase device id as a service.
4. The "language" most likely used is "HTTP headers".
See #1; if you block your headers there are other ways to tell.
* Examples:
Developers change the UAS for various reasons, like testing a browser in-place, command-line security/automation, or to give website operators information on just what you are (the idea behind robots.txt, etc).
Here, I just send something informative so the webmaster is less likely to block my codes / the server (especially when I was beta testing):
https://code.sololearn.com/WOdY9NmHfU14/?ref=app
Line 59 [JS]: ... fetch(workaroundCORS, {method:'GET' .... User-Agent: ...}
https://code.sololearn.com/choOE8kwZEmk/?ref=app
Line 56: hostHeader += 'User-Agent: ...'
Run this code to see exactly what HTTP headers look like (server response shown; request is same format)
+ 8
https://www.w3schools.com/jsref/prop_nav_useragent.asp
^Read up on user agent. That's how you can see what they're using, as far as browser/device.
A demonstration of all navigator properties in one example:
https://code.sololearn.com/WmsiFbzSj9m7/#js
var txt = "";
txt += "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt += "<p>Browser Name: " + navigator.appName + "</p>";
txt += "<p>Browser Version: " + navigator.appVersion + "</p>";
txt += "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt += "<p>Browser Language: " + navigator.language + "</p>";
txt += "<p>Browser Online: " + navigator.onLine + "</p>";
txt += "<p>Platform: " + navigator.platform + "</p>";
txt += "<p>User-agent header: " + navigator.userAgent + "</p>";
document.write(txt);