QWebEngineUrlRequestInterceptor Class

The QWebEngineUrlRequestInterceptor class provides an abstract base class for URL interception. More...

Header: #include <QWebEngineUrlRequestInterceptor>
Since: Qt 5.6

Public Functions

QWebEngineUrlRequestInterceptor(QObject *p = Q_NULLPTR)
virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0

Detailed Description

The QWebEngineUrlRequestInterceptor class provides an abstract base class for URL interception.

Implementing the QWebEngineUrlRequestInterceptor interface and installing the interceptor on the profile enables intercepting, blocking, and modifying URL requests before they reach the networking stack of Chromium.

See also QWebEngineUrlRequestInterceptor::interceptRequest and QWebEngineUrlRequestInfo.

Member Function Documentation

QWebEngineUrlRequestInterceptor::QWebEngineUrlRequestInterceptor(QObject *p = Q_NULLPTR)

Creates a new QWebEngineUrlRequestInterceptor object with p as parent.

[pure virtual] void QWebEngineUrlRequestInterceptor::interceptRequest(QWebEngineUrlRequestInfo &info)

Reimplementing this virtual function and setting the interceptor on a profile makes it possible to intercept URL requests. This function is executed on the IO thread, and therefore running long tasks here will block networking.

info contains the information about the URL request and will track internally whether its members have been altered.

See also QWebEngineProfile::setRequestInterceptor.