Search code examples
qwebviewqwebpage

QWebPage. How to handle failed request


I want to handle failed requests (for example, with http 404 error code in reply), display my own "notfound.html" page in QWebView. But there is no simple way to handle replies with QWebView/QWebPage classes.

My version of Qt is 4.7.


Solution

  • The answer is to use reimplemented function qwebpage::extension. There you can specify error handler for three different error domains: http errors, qtnetwork layer errors, qtwebkit layer errors.