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, and unlikely to identify a user. The values returned by GetHighEntropyValues(List<string>) could potentially reveal more information. These values are therefore retrieved via a {{jsxref("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 is a {{jsxref("Promise")}} that resolves with a dictionary object containing the high entropy values the user-agent returns.
[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):
Remarks
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, and unlikely to identify a user.
The values returned bygetHighEntropyValues()could potentially reveal more information.
These values are therefore retrieved via a Promise, allowing time for the browser to request user permission, or make other checks.
-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.