I\'m executing an external script, using a inside
.
Now since the script executes before the pa
In below snippet I collect choosen methods and show their sequence. Remarks
document.onload
(X) is not supported by any modern browser (event is never fired)
(F) and at the same time window.onload
(E) then only first one will be executed (because it override second one)
(F) is wrapped by additional onload
functiondocument.onreadystatechange
(D) not override document .addEventListener('readystatechange'...)
(C) probably cecasue onXYZevent-like
methods are independent than addEventListener
queues (which allows add multiple listeners). Probably nothing happens between execution this two handlers.div
write their timestamps also in body (click "Full Page" link after script execution to see it).readystatechange
(C,D) are executed multiple times by browser but for different document states:
DOMContentLoaded
body/window onload