Tower
Tower

Reputation: 102915

How to view errors on Qt WebView control?

I think my web page has some JavaScript errors that make QWebView to not work. Is there some simple way to see JS errors while I'm running the debug build?

Upvotes: 3

Views: 1940

Answers (1)

Override the javaScriptConsoleMessage function:

http://doc.qt.io/qt-5/qwebenginepage.html#javaScriptConsoleMessage

As the documentation says, the default implementation does nothing...you can dump it as debug output, or whatever. See also this article:

Redirecting JavaScript console messages in a Qt hybrid application (Internet Archive)

Upvotes: 4

Related Questions