That is what I was afraid of. It is difficult to test and I have not been able to find any real information about this.
So it seems it is necessary to check if onload has fired. Off looking for that information now... On Dec 14, 8:07 am, Peter van der Zee <jsment...@qfox.nl> wrote: > On Fri, Dec 9, 2011 at 1:53 AM, Geoffrey Knutzen <geoffr...@seanet.com> wrote: > > If a script is included on an html page with the deferred attribute, and the > > script attaches a handler to the window.onload event, and the onload event > > fires, will that handler ALWAYS be executed? > > Depends on actual execution of the script. If the script is executed > before window.onload is fired but after everything else then yes, your > callback will fire. If deferred causes your script to run some time > after window.onload to fire then no, your callback doesn't fire. At > this time I'm not sure whether deferred guarantees either but I'm sure > you can easily search for that. > > The point is that the onload only fires once. If your script was > executed before that, your callback will be executed, else it wont. > > - peter -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com