Search code examples
c++qtqwebengineview

QWebEngineView request body interception


A user using QWebEngineView in my application fills some form. This form uses post method to submit data to server. How can I get params from user's body request?

I've found such thing as QWebEngineUrlRequestInterceptor, but it works only for urls.


Solution

  • You can use QWebEnginePage::acceptNavigationRequest.

    Whenever a form is submitted, you can get the contents of input by using JavaScript and then accept the request to proceed as usual.