How to catch "window.onload" webpage event ?
Qt WebKit
2
Posts
2
Posters
1.8k
Views
1
Watching
-
wrote on 26 Mar 2014, 08:34 last edited by
Hi,
I am using QtWebKit in Qt 4.8.
I want to know that when could I execute the following Qt code to insert a javascript function for handling the "window.onload" webpage event :
webview->page()->mainFrame()->evaluateJavaScript("window.onload = function() {alert('test');};");
Should I execute the above code when the "loadStarted()" signal of a QWebView emits ? or should it be executed at other times ?
Thanks in advance for any suggestion.
Lawrence
-
wrote on 2 Apr 2014, 21:56 last edited by
Maybe you could try QWebFrame::javaScriptWindowObjectCleared() or loadFinished().
But loadStarted() would be to early I think.