Click to See Complete Forum and Search --> : detecting page load completion
Michael Perry
11-17-2003, 03:12 PM
I have a page that displays a large number of product images and would like to disable certain links on the page till all the images are loaded.
Is there a way to detect if or when the page and all its dependant files are completely downloaded?
Thanks in advance for your help.
gil davis
11-17-2003, 03:26 PM
I suspect there is something you aren't telling us.
Or are you really not aware of the "onload" event?
fredmv
11-17-2003, 03:26 PM
onload = function() { alert("Page loaded."); }
Michael Perry
11-17-2003, 03:39 PM
Of course i'm aware of onload() but it fires immediately after the base html document is completely downloaded. It does not wait for all the dependants. I need to know that every single image and linked file has completely finished downloading before I enable the links on my page. Obviously the browser is aware of this state as it does not display "Done" in the status bar till all files are loaded. I just haven't been able to find Javascript method that has visibility to this state.
Any ideas?
Originally posted by fredmv
onload = function() { alert("Page loaded.");
There should be an ending brace on that code, fredmv. ;)
[J]ona
fredmv
11-17-2003, 04:07 PM
Originally posted by Jona
There should be an ending brace on that code, fredmv.Good call. :D
Originally posted by Michael Perry
Of course i'm aware of onload() but it fires immediately after the base html document is completely downloaded. It does not wait for all the dependants. I need to know that every single image and linked file has completely finished downloading before I enable the links on my page. Obviously the browser is aware of this state as it does not display "Done" in the status bar till all files are loaded. I just haven't been able to find Javascript method that has visibility to this state.
Well, use the onload function and, using Fredmv's code, see if it works. If it doesn't, there's no other way that I'm aware of...
Originally posted by fredmv
Good call. :D
Typographical errors are the most tedious for a Web developer--we call make these mistakes, myself included. :)
[J]ona