QWebEngineUrlResponseInterceptor Class

The QWebEngineUrlResponseInterceptor class provides an abstract base class for URL response interception. More...

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

Public Functions

QWebEngineUrlResponseInterceptor(QObject *p = nullptr)
virtual void interceptResponseHeaders(QWebEngineUrlResponseInfo &info) = 0

Detailed Description

Implementing the QWebEngineUrlResponseInterceptor interface and installing the interceptor on the profile or the page enables intercepting, blocking, and modifying URL responses right as they come off the networking stack. Currently, only the response headers can be accessed and modified.

You can install the interceptor on a profile via QWebEngineProfile::setUrlResponseInterceptor() or QQuickWebEngineProfile::setUrlResponseInterceptor() and on a page via QWebEnginePage::setUrlResponseInterceptor().

See also QWebEngineUrlResponseInterceptor::interceptResponseHeaders(), QWebEngineProfile::setUrlResponseInterceptor(), QQuickWebEngineProfile::setUrlResponseInterceptor(), and QWebEnginePage::setUrlResponseInterceptor().

Member Function Documentation

[explicit] QWebEngineUrlResponseInterceptor::QWebEngineUrlResponseInterceptor(QObject *p = nullptr)

Creates a new response interceptor object with p as parent.

[pure virtual] void QWebEngineUrlResponseInterceptor::interceptResponseHeaders(QWebEngineUrlResponseInfo &info)

Reimplement this virtual function to intercept URL response headers. This method stalls the URL load until handled.

info contains the request and response data. Call info.setResponseHeaders() to modify the response headers.

See also QWebEngineUrlResponseInfo.

© 2023 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.