views:

53

answers:

3

Hi,

is there a way to see which elements of a website are still loading so that window.onload can't fire yet?

A: 

i don't think so, but if you don't want to wait till all images are loaded, you can use a domready-function

oezi
I'm doing that already, but thank you. :) It was just out of curiosity.
Bernhard V
A: 

I don't know of a global way of doing this - it could well be there is none.

The only thing in that vein that comes to mind is checking images for whether they have successfully loaded. I guess you could walk through each image and check for those properties.

However, you will be having a hard time to tell apart failed image load processes and those still under way. To make that distiction, you would have to work with the onerror event for each image and set some sort of "failed" flag.

What is going to be really, really hard is controlling slowly loading scripts: If a script loads slowly, there is no execution of JavaScript for that moment, so there is no way to detect any delays here except by using the asnyc or defer properties... But I guess that would require fundamental changes to whatever JavaScript you are using.

Pekka
+1  A: 

The network-tab in Firebug might help you.

koko
Firebug tells me that all images are loaded when actually the mouse cursor still is displayed as a loading icon and the window.onload event hasn't triggered yet.
Bernhard V