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

NameDescription
ClientHintsOptions()

ClientHintsOptions()

ClientHintsOptions.cs
public ClientHintsOptions()

No documentation is available.

Properties

NameDescription
ArchitectureGets 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).
BitnessGets 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).
BrandsGets 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.
DefaultGets the default values: the brand of the library, a desktop device, an unknown platform, and no device nor network information.
DeviceMemoryGets 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.
DownlinkGets 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.
EffectiveConnectionTypeGets 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.
FormFactorsGets 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.
FullVersionGets 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.
FullVersionListGets 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.
MobileGets or sets whether the user agent prefers a mobile experience (navigator.userAgentData.mobile and the Sec-CH-UA-Mobile header). The default is false.
ModelGets 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.
PlatformGets 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.
PlatformVersionGets 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.
RoundTripTimeGets 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.
SaveDataGets 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.
Wow64Gets 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.

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).

public string Architecture { get; init; }

Property value

string

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).

public string Bitness { get; init; }

Property value

string

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.

public IReadOnlyList<NavigatorUABrandVersion> Brands { get; init; }

Gets 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

ClientHintsOptions

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.

public double? DeviceMemory { get; init; }

Property value

double?

EffectiveConnectionType

ClientHintsOptions.cs

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.

public string? EffectiveConnectionType { get; init; }

Property value

string?

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.

public IReadOnlyList<string> FormFactors { get; init; }

Property value

IReadOnlyList<string>

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.

public string FullVersion { get; init; }

Property value

string

FullVersionList

ClientHintsOptions.cs

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.

public IReadOnlyList<NavigatorUABrandVersion> FullVersionList { get; init; }

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.

public bool Mobile { get; init; }

Property value

bool

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.

public string Model { get; init; }

Property value

string

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.

public string Platform { get; init; }

Property value

string

PlatformVersion

ClientHintsOptions.cs

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.

public string PlatformVersion { get; init; }

Property value

string

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.

public TimeSpan? RoundTripTime { get; init; }

Property value

TimeSpan?

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.

public bool SaveData { get; init; }

Property value

bool

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.

public bool Wow64 { get; init; }

Property value

bool

Methods

NameDescription
Equals(ClientHintsOptions?)
Equals(object?)
GetHashCode()
ToString()

Equals overloads

Equals(ClientHintsOptions?)

public bool Equals(ClientHintsOptions? other)
Parameters
other ClientHintsOptions?
Returns

bool

No documentation is available.

Equals(object?)

public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

ToString()

public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(ClientHintsOptions?, ClientHintsOptions?)
operator !=(ClientHintsOptions?, ClientHintsOptions?)

operator ==(ClientHintsOptions?, ClientHintsOptions?)

public static bool operator ==(ClientHintsOptions? left, ClientHintsOptions? right)

Parameters

left ClientHintsOptions?
right ClientHintsOptions?

Returns

bool

No documentation is available.

operator !=(ClientHintsOptions?, ClientHintsOptions?)

public static bool operator !=(ClientHintsOptions? left, ClientHintsOptions? right)

Parameters

left ClientHintsOptions?
right ClientHintsOptions?

Returns

bool

No documentation is available.