- Qt 6.10
- Qt WebEngine
- C++ Classes
- QtWebEngineCore
- QWebEngineClientHints
- Qt 6.10.2 Reference Documentation

# QWebEngineClientHints Class

The QWebEngineClientHints class provides an object to customize User-Agent Client Hints used by a profile. More...

Header: | `#include <QWebEngineClientHints>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)` `target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)`
qmake: | `QT += webenginecore`
Since: | Qt 6.8
Inherits: | QObject

- List of all members, including inherited members

## Properties

arch : QString bitness : QString formFactors : QStringList fullVersion : QString fullVersionList : QVariantMap isAllClientHintsEnabled : bool | mobile : bool model : QString platform : QString platformVersion : QString wow64 : bool

## Public Functions

QString | arch() const
QString | bitness() const
QStringList | formFactors() const
QString | fullVersion() const
QVariantMap | fullVersionList() const
bool | isAllClientHintsEnabled()
bool | isMobile() const
bool | isWow64() const
QString | model() const
QString | platform() const
QString | platformVersion() const
void | resetAll()
void | setAllClientHintsEnabled(bool enabled)
void | setArch(const QString &)
void | setBitness(const QString &)
void | setFormFactors(const QStringList &)
void | setFullVersion(const QString &)
void | setFullVersionList(const QVariantMap &)
void | setIsMobile(bool)
void | setIsWow64(bool)
void | setModel(const QString &)
void | setPlatform(const QString &)
void | setPlatformVersion(const QString &)

## Detailed Description

QWebEngineClientHints allows configuration of exposing browser and platform information via User-Agent response and request headers, and a JavaScript API.

The information accessed via this API is split into two groups: low entropy and high entropy hints. Low entropy hints (platform and mobile) are those that do not give away much information; the API makes these accessible with every request and they can not be disabled by QWebEngineClientHints::setAllClientHintsEnabled.

All the others are high entropy hints; they have the potential to give away more information, therefore they can be disabled by QWebEngineClientHints::setAllClientHintsEnabled.

Each profile object has its own QWebEngineClientHints object, which configures the Client Hint settings for that browsing context. If a Client Hint is not configured for a web engine profile, its default value is deduced from the system.

See also QWebEngineProfile::clientHints() and QQuickWebEngineProfile::clientHints().

## Property Documentation

### arch : QString

The value of the `Sec-CH-UA-Arch` HTTP header and `architecture` member of NavigatorUAData in JavaScript.

Access functions:

QString | arch() const
void | setArch(const QString &)

### bitness : QString

The value of the `Sec-CH-UA-Bitness` HTTP header and `bitness` member of NavigatorUAData in JavaScript.

Access functions:

QString | bitness() const
void | setBitness(const QString &)

### formFactors : QStringList

The value of the `Sec-CH-UA-Form-Factors` HTTP request header.

It gives a server information about the user agent's form-factors. It is a structured header whose value must be a list. The header's values are case-sensitive. For more information refer https://wicg.github.io/ua-client-hints/#sec-ch-ua-form-factors

Access functions:

QStringList | formFactors() const
void | setFormFactors(const QStringList &)

### fullVersion : QString

The value of the `Sec-CH-UA-Full-Version` HTTP header and `uaFullVersion` member of NavigatorUAData in JavaScript.

Access functions:

QString | fullVersion() const
void | setFullVersion(const QString &)

### fullVersionList : QVariantMap

The value of the `Sec-CH-UA-Full-Version-List` HTTP header and `fullVersionList` member of NavigatorUAData in JavaScript.

The value of Sec-CH-UA header will also be generated from this by truncating the version numbers.

It holds brand name and version number pairs in a QVariantMap. The provided values will be automatically extended by the currently used version of Chromium and a semi-random brand.

Access functions:

QVariantMap | fullVersionList() const
void | setFullVersionList(const QVariantMap &)

### isAllClientHintsEnabled : bool

This property controls whether the Client Hints HTTP headers are sent by WebEngine or not.

Enabled by default.

Access functions:

bool | isAllClientHintsEnabled()
void | setAllClientHintsEnabled(bool enabled)

### mobile : bool

The value of the `Sec-CH-UA-Mobile` HTTP header and `mobile` member of NavigatorUAData in JavaScript.

Can not be disabled.

Access functions:

bool | isMobile() const
void | setIsMobile(bool)

### model : QString

The value of the `Sec-CH-UA-Model` HTTP header and `model` member of NavigatorUAData in JavaScript.

Access functions:

QString | model() const
void | setModel(const QString &)

### platform : QString

The value of the `Sec-CH-UA-Platform` HTTP header and `platform` member of NavigatorUAData in JavaScript.

Can not be disabled.

Access functions:

QString | platform() const
void | setPlatform(const QString &)

### platformVersion : QString

The value of the `Sec-CH-UA-Platform-Version` HTTP header and `platformVersion` member of NavigatorUAData in JavaScript.

Access functions:

QString | platformVersion() const
void | setPlatformVersion(const QString &)

### wow64 : bool

The value of the `Sec-CH-UA-Wow64` HTTP header and `wow64` member of NavigatorUAData in JavaScript.

Access functions:

bool | isWow64() const
void | setIsWow64(bool)

## Member Function Documentation

### `[invokable]` void QWebEngineClientHints::resetAll()

Resets all Client Hints settings to their default values.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.