ClientHintsOptions Class
The values of the client hints of the browsing contexts (see BrowsingContextOptions.ClientHints): the identity of the user agent given by the User-Agent Client Hints (https://wicg.github.io/ua-client-hints/, the Sec-CH-UA-* request headers and navigator.userAgentData), and the device and network hints of the Client Hints infrastructure (https://wicg.github.io/client-hints-infrastructure/). The hints of the viewport and of the preferences of the user (Sec-CH-DPR, Sec-CH-Viewport-Width, Sec-CH-Prefers-Color-Scheme...) are the values of BrowsingContextOptions.Viewport.
public sealed class ClientHintsOptions : IEquatable<ClientHintsOptions>Remarks
The default values describe the library, not the machine it runs on: an unknown platform, no architecture, no device memory and no network information. A hint whose value is null is not sent.
- Implements
Constructors
| Name | Description |
|---|---|
| ClientHintsOptions() |
ClientHintsOptions()
ClientHintsOptions.cspublic ClientHintsOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| Architecture | Gets or sets the architecture of the platform (the architecture of getHighEntropyValues() and the Sec-CH-UA-Arch header): x86, arm or the empty string (the default). |
| Bitness | Gets or sets the bitness of the architecture of the platform (the bitness of getHighEntropyValues() and the Sec-CH-UA-Bitness header): 32, 64 or the empty string (the default). |
| Brands | Gets or sets the brands of the user agent and their significant versions (https://wicg.github.io/ua-client-hints/#brands): navigator.userAgentData.brands and the Sec-CH-UA header. A brand should be shorter than 32 characters. The default is the brand of the library with its major version; no arbitrary ("GREASE") brand is added, and the order is kept: add one and shuffle the list to follow the recommendation of the specification. |
| Default | Gets the default values: the brand of the library, a desktop device, an unknown platform, and no device nor network information. |
| DeviceMemory | Gets or sets the memory of the device, in GiB (the Sec-CH-Device-Memory header, https://www.w3.org/TR/device-memory/#sec-device-memory-client-hint-header): the value is rounded down to a power of two between 0.25 and 8. The default is null: the hint is not sent. |
| Downlink | Gets or sets the effective bandwidth of the connection, in megabits per second (the Downlink hint, https://wicg.github.io/netinfo/#downlink-request-header-field). As in Chromium, the value is rounded to a multiple of 50 kilobits per second, and is 10 megabits per second at most. The default is null: the hint is not sent. |
| EffectiveConnectionType | Gets or sets the effective connection type (the ECT hint, https://wicg.github.io/netinfo/#ect-request-header-field): slow-2g, 2g, 3g or 4g. The default is null: the hint is not sent. |
| FormFactors | Gets or sets the form factors of the device (the formFactors of getHighEntropyValues() and the Sec-CH-UA-Form-Factors header), e.g. Desktop, Mobile or Tablet. The header lists them in lexical order. The default is Desktop. |
| FullVersion | Gets or sets the full version of the user agent (the deprecated uaFullVersion of getHighEntropyValues() and the Sec-CH-UA-Full-Version header). The default is the version of the library. |
| FullVersionList | Gets or sets the brands of the user agent and their full versions (the fullVersionList of getHighEntropyValues() and the Sec-CH-UA-Full-Version-List header). The default is the brand of the library with its version. |
| Mobile | Gets or sets whether the user agent prefers a mobile experience (navigator.userAgentData.mobile and the Sec-CH-UA-Mobile header). The default is false. |
| Model | Gets or sets the model of the device (the model of getHighEntropyValues() and the Sec-CH-UA-Model header). The default is the empty string, as on the platforms that do not expose it. |
| Platform | Gets or sets the platform brand (navigator.userAgentData.platform and the Sec-CH-UA-Platform header), e.g. Windows, macOS, Linux or Android. The default is Unknown. |
| PlatformVersion | Gets or sets the version of the platform (the platformVersion of getHighEntropyValues() and the Sec-CH-UA-Platform-Version header), e.g. 15.0.0; the empty string on Linux (https://wicg.github.io/ua-client-hints/#get-the-platform-version). The default is the empty string. |
| RoundTripTime | Gets or sets the effective round-trip time of the connection (the RTT hint, https://wicg.github.io/netinfo/#rtt-request-header-field). As in Chromium, the value is rounded to a multiple of 50 milliseconds, and is 3 seconds at most. The default is null: the hint is not sent. |
| SaveData | Gets or sets whether the user prefers a reduced data usage (https://wicg.github.io/savedata/#save-data-request-header-field): the Save-Data: on header is then sent with the requests to the secure origins, without opt-in. The default is false. |
| Wow64 | Gets or sets whether the user agent runs in 32-bit mode on 64-bit Windows (the wow64 of getHighEntropyValues() and the Sec-CH-UA-WoW64 header). The default is false. |
Architecture
ClientHintsOptions.csBitness
ClientHintsOptions.csBrands
ClientHintsOptions.csGets or sets the brands of the user agent and their significant versions (https://wicg.github.io/ua-client-hints/#brands): navigator.userAgentData.brands and the Sec-CH-UA header. A brand should be shorter than 32 characters. The default is the brand of the library with its major version; no arbitrary ("GREASE") brand is added, and the order is kept: add one and shuffle the list to follow the recommendation of the specification.
public IReadOnlyList<NavigatorUABrandVersion> Brands { get; init; }Property value
Default
ClientHintsOptions.csGets the default values: the brand of the library, a desktop device, an unknown platform, and no device nor network information.
public static ClientHintsOptions Default { get; }Property value
DeviceMemory
ClientHintsOptions.csGets or sets the memory of the device, in GiB (the Sec-CH-Device-Memory header, https://www.w3.org/TR/device-memory/#sec-device-memory-client-hint-header): the value is rounded down to a power of two between 0.25 and 8. The default is null: the hint is not sent.
public double? DeviceMemory { get; init; }Property value
Downlink
ClientHintsOptions.csGets or sets the effective bandwidth of the connection, in megabits per second (the Downlink hint, https://wicg.github.io/netinfo/#downlink-request-header-field). As in Chromium, the value is rounded to a multiple of 50 kilobits per second, and is 10 megabits per second at most. The default is null: the hint is not sent.
public double? Downlink { get; init; }Property value
EffectiveConnectionType
ClientHintsOptions.csFormFactors
ClientHintsOptions.csGets or sets the form factors of the device (the formFactors of getHighEntropyValues() and the Sec-CH-UA-Form-Factors header), e.g. Desktop, Mobile or Tablet. The header lists them in lexical order. The default is Desktop.
public IReadOnlyList<string> FormFactors { get; init; }Property value
FullVersion
ClientHintsOptions.csFullVersionList
ClientHintsOptions.csGets or sets the brands of the user agent and their full versions (the fullVersionList of getHighEntropyValues() and the Sec-CH-UA-Full-Version-List header). The default is the brand of the library with its version.
public IReadOnlyList<NavigatorUABrandVersion> FullVersionList { get; init; }Property value
Mobile
ClientHintsOptions.csPlatform
ClientHintsOptions.csPlatformVersion
ClientHintsOptions.csGets or sets the version of the platform (the platformVersion of getHighEntropyValues() and the Sec-CH-UA-Platform-Version header), e.g. 15.0.0; the empty string on Linux (https://wicg.github.io/ua-client-hints/#get-the-platform-version). The default is the empty string.
public string PlatformVersion { get; init; }Property value
RoundTripTime
ClientHintsOptions.csGets or sets the effective round-trip time of the connection (the RTT hint, https://wicg.github.io/netinfo/#rtt-request-header-field). As in Chromium, the value is rounded to a multiple of 50 milliseconds, and is 3 seconds at most. The default is null: the hint is not sent.
public TimeSpan? RoundTripTime { get; init; }Property value
SaveData
ClientHintsOptions.csMethods
| Name | Description |
|---|---|
| Equals(ClientHintsOptions?) | |
| Equals(object?) | |
| GetHashCode() | |
| ToString() |
Equals overloads
Equals(ClientHintsOptions?)
public bool Equals(ClientHintsOptions? other)No documentation is available.
Equals(object?)
GetHashCode()
ToString()
Operators
| Name | Description |
|---|---|
| operator ==(ClientHintsOptions?, ClientHintsOptions?) | |
| operator !=(ClientHintsOptions?, ClientHintsOptions?) |
operator ==(ClientHintsOptions?, ClientHintsOptions?)
public static bool operator ==(ClientHintsOptions? left, ClientHintsOptions? right)No documentation is available.
operator !=(ClientHintsOptions?, ClientHintsOptions?)
public static bool operator !=(ClientHintsOptions? left, ClientHintsOptions? right)No documentation is available.