acceptNavigationRequest only called for explicitly clicked links



  • I have an application, which shows html-mails in a QWebEngineView. I want to filter requests for external images (or other http-requests). Therefore I have a subclass of QWebEnginePage and implemented the acceptNavigationRequest-method. I set an instance of this subclass via setPage in my QWebEngineView. Then I call setHtml with the mail-body and a local BaseUrl.
    But the html-page the acceptNavigationRequest-method isn't called when the html-page is loaded. So all images are shown although the links are absolute (eample: <img src="http://xxx.com/images/yyy.jpg">).

    The acceptNavigationRequest-method is only called if I click on a html-link (example <a href="https://xxx.com/zzz">). Is there any possibility, that the method will also be called for external images? Or is there another method to control the requests for images on external server?

    I found the solution to my problem. It is possible to supress the automatic loading of images with the QWebEngineSettings::AutoLoadImages attribute.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.