Class NavigatorUAData
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
NOTE
ExperimentalNavigatorUAData interface of the {{domxref("User-Agent Client Hints API", "", "", "nocode")}} returns information about the browser and operating system of a user.
[Value("NavigatorUAData")]
public class NavigatorUAData
- Inheritance
-
NavigatorUAData
- Inherited Members
Remarks
An instance of this object is returned by calling Navigator.UserAgentData or WorkerNavigator.UserAgentData. Therefore, this interface has no constructor.
NOTE
The terms high entropy and low entropy refer to the amount of information these values reveal about the browser. The values returned as properties are deemed low entropy, which are unlikely to identify a user. The GetHighEntropyValues(List<string>) can be used to request additional high entropy values, which could potentially reveal more identifying information. These values are therefore retrieved via a Promise, allowing time for the browser to request user permission, or make other checks.
-Improving user privacy and developer experience with User-Agent Client Hints
Constructors
NavigatorUAData()
public NavigatorUAData()
Properties
Brands
NOTE
Experimentalbrands read-only property of the NavigatorUAData interface returns an array of brand information.
[Value("brands")]
public NavigatorUABrandVersion[] Brands { get; }
Property Value
- NavigatorUABrandVersion[]
An array containing the following information for each brand:
Remarks
-Sec-CH-UA (a low-entropy client hint) contains the same information.
Mobile
NOTE
Experimentalmobile read-only property of the NavigatorUAData interface returns a value indicating whether the device is a mobile device.
[Value("mobile")]
public bool Mobile { get; }
Property Value
Remarks
-The Sec-CH-UA-Mobile header (a low-entropy client hint) contains the same information.
Platform
NOTE
Experimentalplatform read-only property of the NavigatorUAData interface returns the platform brand information.
[Value("platform")]
public string Platform { get; }
Property Value
- string
A string containing the platform brand.
For example,"Windows".
Remarks
-The Sec-CH-UA-Platform header (a low-entropy client hint) contains the same information.
Methods
GetHighEntropyValues(List<string>)
NOTE
ExperimentalgetHighEntropyValues() method of the NavigatorUAData interface returns a {{jsxref("Promise")}} that resolves with a dictionary object containing low entropy information and requested high entropy information about the browser.
[Value("getHighEntropyValues")]
public Task<UADataValues> GetHighEntropyValues(List<string> hints)
Parameters
Returns
- Task<UADataValues>
A Promise that resolves to an object containing some or all of the following values (based on the hints requested and granted):
Remarks
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 the 'Permissions-Policy/ch-ua-high-entropy-values' 'Permissions-Policy'.
If the permission is not allowed, the method will only return thebrands,mobile, andplatformlow-entropy data.
-These values are also available as via HTTP request headers:-Low-entropy client hints are sent automatically:-Sec-CH-UA
-Sec-CH-UA-Mobile
-Sec-CH-UA-Platform
-Servers can request to receive high-entropy client hints on subsequent requests, using the Accept-CH header:-Sec-CH-UA-Arch
-Sec-CH-UA-Bitness
-Sec-CH-UA-Full-Version
-Sec-CH-UA-Model
-Sec-CH-UA-Platform-Version
ToJSON()
NOTE
ExperimentaltoJSON() method of the NavigatorUAData interface is a serializer that returns a JSON representation of the low entropy properties of the NavigatorUAData object.
[Value("toJSON")]
public UALowEntropyJSON ToJSON()
Returns
- UALowEntropyJSON
A JSON object.
Remarks
NOTE
The terms high entropy and low entropy refer to the amount of information these values reveal about the browser. The low entropy values returned by this method are those which do not reveal information able to identify a user. High entropy values can only be returned by the GetHighEntropyValues(List<string>) method.