Enabling and Disabling JavaScript alerts

  • HI,
    I wanted to to enable and disable javaScript alerts. I need to keep the JavaScript enabled. I only want to turn Off this alert feature. I found out that the way to achieve this was to subclass QWebPage and reimplement javaScriptAlert function.


    Is there any other way to do this? Because I need to restructure my code if I want to subclass QWebPage. I didn't know it at the development time and when I wanted to disable javaScript alert I found this way.

    I also tried the following
    I knew which function caused javaScript alerts so before entering that function I disabled Javascript using (QWebSettings::setAttribute()) and re-enabled javaScript after exiting the function. But that didn't work.

    Thanx in advance :)

  • Reimplementing the javaScriptAlert/confirm etc. functions is the way to do it. There isn't really another one.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.