[go: up one dir, main page]

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

Properties

Public Functions

QString arch() const
QString bitness() 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 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 &)

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.

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.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.