Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. How to catch "window.onload" webpage event ?
Forum Updated to NodeBB v4.3 + New Features

How to catch "window.onload" webpage event ?

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tkwinfo
    wrote on 26 Mar 2014, 08:34 last edited by
    #1

    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

    1 Reply Last reply
    0
    • K Offline
      K Offline
      KuhTee
      wrote on 2 Apr 2014, 21:56 last edited by
      #2

      Maybe you could try QWebFrame::javaScriptWindowObjectCleared() or loadFinished().
      But loadStarted() would be to early I think.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved