5

I was on jsfiddle.net recently and I saw this as a configuration option. This got me to thinking that it might help a problem I'm having as such:

I load multiple images (haven't upgraded to a single sprite yet) so that I can not use my controls until they are all downloaded...the images take most of the download time so that for the first few seconds I can not access my controls.

Currently I'm using one of these two..both work.

window.onload = initialize_page

window.addEventListener('load',initialize_page);

Related

Jquery document ready vs. window.onload

window.onload vs. body.onload vs. document.onready

window.onload vs <body onload=""/>

Community
  • 1
  • 1

1 Answers1

5

AFAIK onDomReady() fires once the DOM has loaded. If the page contains external sources, such as images, then it may fire before these have finished loading. onLoad() fires after the whole page has finished loading, including external sources.

So it's possible for onDomReady() to fire before onLoad() but you'll have to test it on your page.

Jivings
  • 22,834
  • 6
  • 60
  • 101
  • @stack.user.0: `window.addEventListener('DOMContentLoaded',function(){//},false);`. See http://ie.microsoft.com/testdrive/HTML5/DOMContentLoaded/Default.html – Zeta Jan 20 '12 at 00:30
  • Unfortunately that event is not fired on Safari or IE, the two broswers I'm targeting...thanks for the info though –  Jan 21 '12 at 17:36