Custom error page for QtWebEngine
-
Is there any way to set a custom error page for QtWebEngine? Or maybe there is some way to get the error status code when QWebEnginePage emits loadFinished(false)?
Or maybe there is some way to get the error status code when QWebEnginePage emits loadFinished(false)?
Good question! Does https://stackoverflow.com/questions/40309105/capture-server-response-with-qwebengineview give you any help/leads for getting at the status code? It's useful reading anyway.
EDIT Hmm, https://stackoverflow.com/questions/51656117/how-to-get-http-status-codes-from-qt-qwebengineview talks about trying
QWebEngineUrlRequestInterceptor
but I think no luck. Again you should read because it looks like others are having same problem as you getting at the HTTP code. And http://code.qt.io/cgit/qt/qtwebengine.git/tree/src/webenginewidgets/api/qwebenginepage.cpp#n367 might be useful. -
Or maybe there is some way to get the error status code when QWebEnginePage emits loadFinished(false)?
Good question! Does https://stackoverflow.com/questions/40309105/capture-server-response-with-qwebengineview give you any help/leads for getting at the status code? It's useful reading anyway.
EDIT Hmm, https://stackoverflow.com/questions/51656117/how-to-get-http-status-codes-from-qt-qwebengineview talks about trying
QWebEngineUrlRequestInterceptor
but I think no luck. Again you should read because it looks like others are having same problem as you getting at the HTTP code. And http://code.qt.io/cgit/qt/qtwebengine.git/tree/src/webenginewidgets/api/qwebenginepage.cpp#n367 might be useful. -
@JonB Thanks for your reply, but I have no idea how to use your latest link to solve my problem.
@popov895
If by "your latest link" you mean http://code.qt.io/cgit/qt/qtwebengine.git/tree/src/webenginewidgets/api/qwebenginepage.cpp#n367, I am suggesting you examine that source code to understand what Qt is actually doing inloadFinished(false)
, e.g. at first glance it does not seem to be passingerrorCode
/errorDescription
on to the emitted signal. I know nothing, but it does testsettings->testAttribute(QWebEngineSettings::ErrorPageEnabled)
, so maybe that gives a clue that there is some access to an error page?