web api instance method
NavigatorUAData: getHighEntropyValues() method
Limited availabilityAvailable in workers
The getHighEntropyValues() method of the NavigatorUAData interface returns a Promise that resolves with a dictionary object containing low entropy information and requested high entropy information about the browser.
The resolved object has the “low entropy” properties available on the NavigatorUAData object included by default — these are the values that are unlikely to enable fingerprinting of the user.
It also contains the subset of “high entropy” values requested in the parameter object, and for which permission has been granted.
These are the values that are more likely to enable fingerprinting.
Note that meaning of the terms low entropy and high entropy is the same as defined in the HTTP User Agent Client Hints mechanism.
[!NOTE] Usage of the
getHighEntropyValues()method to retrieve high-entropy user-agent data can be controlled via thech-ua-high-entropy-valuesPermissions-Policy. If the permission is not allowed, the method will only return thebrands,mobile, andplatformlow-entropy data.
Syntax
getHighEntropyValues(hints)
Parameters
hints- : An array containing the high-entropy hints to be returned.
This may include one or more of:
"architecture""bitness""formFactors""fullVersionList""model""platformVersion""uaFullVersion"Deprecated"wow64"
- : An array containing the high-entropy hints to be returned.
This may include one or more of:
Return value
A Promise that resolves to an object containing some or all of the following values (based on the hints requested and granted):
brands- : Returns an array of objects containing
brandandversionspecifying the browser brand and its version (the same information as provided bybrands). Note that this information can be sent to a server in theSec-CH-UAheader (a low-entropy client hint).
- : Returns an array of objects containing
mobile- : Returns
trueif the user agent is running on a mobile device (the same information as provided bymobile). Note that this information can be sent to a server in theSec-CH-UA-Mobileheader (a low-entropy client hint).
- : Returns
platform- : Returns a string describing the platform the user agent is running on, like
"Windows"(the same information as provided byplatform). Note that this information can be sent to a server in theSec-CH-UA-Platformheader (a low-entropy client hint).
- : Returns a string describing the platform the user agent is running on, like
architecture- : A string containing the platform architecture. For example,
"x86". Note that this information can be sent to a server in theSec-CH-UA-Archheader after the server explicitly requests it in theAccept-CHheader.
- : A string containing the platform architecture. For example,
bitness- : A string containing the architecture bitness. For example,
"32"or"64". Note that this information can be sent to a server in theSec-CH-UA-Bitnessheader if the server explicitly requests it in theAccept-CHheader.
- : A string containing the architecture bitness. For example,
formFactors- : An array of strings containing the form-factors of a device. For example,
["Tablet", "XR"]. Note that this information can be sent to a server in theSec-CH-UA-Form-Factorsheader if the server explicitly requests it in theAccept-CHheader.
- : An array of strings containing the form-factors of a device. For example,
fullVersionList- : An array of objects with properties
"brand"and"version"representing the browser name and full version respectively. For example,{"brand": "Google Chrome", "version": "103.0.5060.134"}, {"brand": "Chromium", "version": "103.0.5060.134"}. Please note that one object may intentionally contain invalid information to prevent sites from relying on a fixed list of browsers. Note that this information can be sent to a server in theSec-CH-UA-Full-Version-Listheader if the server explicitly requests it in theAccept-CHheader.
- : An array of objects with properties
model- : A string containing the model of mobile device. For example,
"Pixel 2XL". If device is not a mobile device or if device model is not known,modelwill be"". Note that this information can be sent to a server in theSec-CH-UA-Modelheader if the server explicitly requests it in theAccept-CHheader.
- : A string containing the model of mobile device. For example,
platformVersion- : A string containing the platform version. Platform name itself is always available as low-entropy hint
platform. For example,"10.0". Note that this information can be sent to a server in theSec-CH-UA-Platform-Versionheader if the server explicitly requests it in theAccept-CHheader.
- : A string containing the platform version. Platform name itself is always available as low-entropy hint
uaFullVersionDeprecated- : A string containing the full browser version. For example,
"103.0.5060.134". Deprecated in favor offullVersionList. Note that this information can be sent to a server in theSec-CH-UA-Full-Versionheader if the server explicitly requests it in theAccept-CHheader.
- : A string containing the full browser version. For example,
wow64- : A boolean indicating if the user agent’s binary is running in 32-bit mode on 64-bit Windows.
Note that this information can be sent to a server in the
Sec-CH-UA-WoW64header if the server explicitly requests it in theAccept-CHheader.
- : A boolean indicating if the user agent’s binary is running in 32-bit mode on 64-bit Windows.
Note that this information can be sent to a server in the
Exceptions
NotAllowedErrorDOMException- : Thrown if the user-agent decides that one or more of the
hintsrequested should not be returned.
- : Thrown if the user-agent decides that one or more of the
Examples
In the following example a number of hints are requested using the getHighEntropyValues() method.
When the promise resolves, this information is printed to the console.
navigator.userAgentData
.getHighEntropyValues([
"architecture",
"model",
"platformVersion",
"fullVersionList",
])
.then((values) => console.log(values));
Specifications
Browser compatibility
See also
- These values are also available as via HTTP request headers:
- Low-entropy client hints are sent automatically:
- Servers can request to receive high-entropy client hints on subsequent requests, using the
Accept-CHheader: