[Qt-interest] How to know when a web page is loaded when using QtWebKit?

Andrew Hodgkinson ahodgkinson at endurancetech.co.uk
Thu Aug 20 12:06:45 CEST 2009


On 20/08/2009 09:15, Piotr Dobrogost wrote:

> Both QWebFrame and QWebPage have void loadFinished(bool ok) signal
> which can be used to detect when a web page is completely loaded.
> The problem is when a web page has some content loaded asynchronously
> (ajax). How to know when the page is completely loaded in this case?

The possibilities for external data loading with JavaScript are almost 
boundless. Scripts may fetch data indefinitely, e.g. repeatedly replace 
part of the page as part of an advertisement carousel. Facebook pages 
continuously check for user status updates. User interactions may cause 
data to be transferred at any time.

In short, many modern AJAX-based web pages are never completely loaded.

Never mind JavaScript - don't forget old fashioned server push. It was 
popular for web cams a few years ago and some pages doubtless still use 
this approach.

Performing code analysis on a web page's dynamic content to determine its 
intent is unlikely to be feasible. To the best of my knowledge, there is 
currently no computationally practical way to tell if any non-trivial web 
page will fetch data and, if it does, whether it will eventually have 
finished fetching or whether it might continue to fetch data forever.

-- 
TTFN, Andrew Hodgkinson
Find some electronic music at:     Photos, wallpaper, software and more:
http://pond.org.uk/music.html                        http://pond.org.uk/



More information about the Qt-interest-old mailing list