View Full Version : WebKit / WebEngine URL substitution

6th December 2016, 10:04
I'm developing the project featuring Qt4 WebKit based browser (will have it moved to Qt5 in the future). It would be nice to allow the users to open .onion sites (dark web), which is not directly possible. In order to achieve this the original url must be modified by adding a special suffix. So my question is whether it is possible to intercept the URL that is going to be opened by the Qt browser and substitute it with the new transformed one?

6th December 2016, 10:42
I don't know if this is possible with QWebKit. But QWebEngineUrlRequestInterceptor is worth looking at.

6th December 2016, 14:59
For Qt4 webkit it should be possible to achieve this by using a custom QNetworkAccessManager.

Basically derive from that class, implement createRequest() such that you create a modified QNetworkRequest object and pass that to the base class implementation.