/Qt 5.11

QWebEngineUrlRequestInterceptor Class

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

Header: #include <QWebEngineUrlRequestInterceptor>
Since: Qt 5.6
Inherits: QObject

Public Functions

QWebEngineUrlRequestInterceptor(QObject *p = ...)
virtual void interceptRequest(QWebEngineUrlRequestInfo &info) = 0
  • 34 public functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 2 signals inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

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.

You can install the interceptor on a profile via QWebEngineProfile::setRequestInterceptor() or QQuickWebEngineProfile::setRequestInterceptor().

When using the Qt WebEngine Widgets Module, QWebEnginePage::acceptNavigationRequest() offers further options to accept or block requests.

See also interceptRequest() and QWebEngineUrlRequestInfo.

Member Function Documentation

QWebEngineUrlRequestInterceptor::QWebEngineUrlRequestInterceptor(QObject *p = ...)

Creates a new QWebEngineUrlRequestInterceptor object with p as parent.

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

Reimplementing this virtual function 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.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.