4

Does window.onlaod include image load? or I must use another event for it?

I want use ajax call to get HTML document which contains images, but I want show this document when all images are loaded.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Taron Mehrabyan
  • 2,199
  • 2
  • 20
  • 27

2 Answers2

5

it does include all webpage's resource's load - more information here: https://developer.mozilla.org/en/docs/DOM/window.onload

pwolaq
  • 6,343
  • 19
  • 45
  • The OP was talking about doing *something*, the real meat of his question is about doing something when the images have loaded. That it is an AJAX call is not significant. I see his other question, which clarifies matters somewhat, but this answer addresses the details given in the question, no need for -1. – Chris Baker Feb 12 '13 at 20:55
  • @Chris of course the fact that it is ajax is significant. The question is about window.onload which will be triggered before the images coming through ajax are loaded. – Christophe Feb 12 '13 at 21:08
  • `window.onload` is not related to AJAX. Now that there's a second (bad) question with more details, it is more clear what the OP is after. In **THIS** question, he asks about sending an AJAX request after "the images" are loaded. He could be asking about changing the font color after "the images" are loaded, about replacing the document content, or firing an AJAX request, it doesn't really matter -- the question is about waiting for "the images" to load and then doing something. The downvote here is uncalled for, the problem is the wording of the question (and making a duplicate). – Chris Baker Feb 12 '13 at 21:14
  • @Chris please read the question carefully, we are talking about **all** images (not "the images"), including the images contained in a document loaded via ajax. – Christophe Feb 12 '13 at 21:16
  • Again (and for the last time -- honestly, who cares?), this question does not make that entirely clear. The OP could have (and should have) simply edited this question to improve the wording instead of making a new one. That aside, I read this question and reach the same conclusion this answer did -- the OP is asking about order of DOM events. He says "Does window.onlaod include image load", and the answer is "yes". The OP doesn't have to accept the answer, but it doesn't deserve a downvote *in my opinion*. The end. – Chris Baker Feb 12 '13 at 21:19
  • honestly, who cares? => well, I just wish people read the whole question, not just the first sentence. – Christophe Feb 12 '13 at 21:25
  • @Chris btw point taken, but unfortunately too late to remove my downvote. – Christophe Feb 12 '13 at 21:38
1

Yep, in short it waits for whole visual content to come together, it will trigger after the completion of the load of all the images, all the frames and their contents.

ASertacAkkaya
  • 651
  • 6
  • 16