Important: Please read the Qt Code of Conduct -

Whitelisting http requests from QWebFrame::evaluateJavaScript

  • Hi folks:

    I want to know if there is a way to whitelist http requests issued by 3rd party JS file which is executed by QWebFrame::evaluateJavaScript.

    Our application need to execute some JS function from an external JS file. We need to prevent that JS getting data other than a whitelist domain. e.g.

    We want to make sure that getYahooData() will only make network requests to domain only.

    Is there any way to get that? Thanks a lot!

  • Moderators

    In the old QWebView there was a way to set custom a QNetworkAccessManager where in one can re-implement some of its methods to intercept the requests.
    If you are using the old version check the following post:

    But if are using a latest i.e Qt WebEngine then you will need to update to Qt 5.6 where they have added new API's to do so. As per this doc.

    We’ve also added a new Qt WebEngineCore module for new low-level APIs. This includes features such as support for custom URL schemes, intercepting and blocking network requests and for tracking and blocking cookies.

Log in to reply