An answer to the question in the header is no.
Practically DOMContentLoaded
fires when </body>
is met, but for example some images can still be under loading. window.onload
fires after all the content and resources (like images and contents of iframes) of the page have been loaded.
When you write to any document using document.write()
after that page has been parsed, write()
implicitely opens the document, but it doesn't close it. "Ready" events can't be fired while the document is open. Hence after document.write()
(s) you've to close the document manually:
document.close();