Please nominate your Qt Champions for 2021!

Suppress JavaScript popup in QWebView

  • Hi everyone,

    I've got an application running on a system with no keyboard or mouse interface. When loading certain web pages with a QWebView, I get a JavaScript popup:

    "The script on this page appears to have a problem. Do you want to stop the script?"

    I want to stop the popup message from happening.

    I've tried subclassing QWebPage and implementing javaScriptAlert, javaScriptConfirm, and javaScriptPrompt, but it appears that none of those functions are getting called. I used setPage() to set the QWebView's page to my custom class.

    Does anyone know what I can do to stop the popup?



  • After more searching, I found this thread:

    Implementing QWebPage::shouldInterruptJavaScript() solved my problem.

Log in to reply