QWebEngineClientHints Class

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

头: #include <QWebEngineClientHints>
CMake: find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
target_link_libraries(mytarget PRIVATE Qt6::WebEngineCore)
qmake: QT += webenginecore
Since: Qt 6.8
继承: QObject

特性

公共函数

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

详细描述

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.

另请参阅 QWebEngineProfile::clientHints () 和 QQuickWebEngineProfile::clientHints ().

特性文档编制

arch : QString

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

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

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.

访问函数:

bool isWow64 () const
void setIsWow64 (bool)

成员函数文档编制

[invokable] void QWebEngineClientHints:: resetAll ()

Resets all Client Hints settings to their default values.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .