Greetings—-
The problem with window.onload before starting scripts is that things like the loading of images must complete before the script executes. Many frameworks have essentially a execute when DOM is loaded option. Here is the problem:
(1) No frameworks such as jQuery allowed
(2) **SIGH
(3) Because of the heavy, heavy use of eye candy images, the total page may take a long time to load, but the functionality of the javascript must exist even before the images have downloaded if there is a problem with download speed.
So here is the thing. I do have other options, but this is something that might serve just as well. I am somewhat leery of it because it seems too good to be true, and might not be browser/old browser compatible. Here it is:
[CODE]
//in the HEAD section
function replacementForDomReady(){
// all sorts of stuff that depend on the DOM being fully loaded
};
setTimeout(replacementForDomReady);
And yes, there is no second arg given for setTimeout. For what I’m doing its not needed.
The question is— what flaws, if any, arise from using this approach? It seems to work. Does anybody know where it doesn’t, or if there can be bad consequences for using such an approach?