Note that there are some explanatory texts on larger screens.

plurals
  1. POUnderstanding HTTP Requests/Responses regarding the DOM and script execution
    primarykey
    data
    text
    <p>I've been away from web design/development for a long, long now and have recently begun to get back into it. I started off doing things just to make them work, and now that I'm getting back into it, I would like to understand things a bit more clearly - including when the DOM is requested by the browser to when it is fully loaded, and the difference between script placement at the top and bottom of a page.</p> <p>I realise that this is more a post for <a href="http://doctype.com" rel="nofollow noreferrer">http://doctype.com</a>, but I figured I would get a more technical answer from here. I would also like to have made this a community wiki, but I don't have enough points...as yet.</p> <p>Please feel free to correct me here - My questions/assumptions:</p> <ol> <li>When the browser makes a request for the page, the server responds with a Document Object that contains the hierarchy/order of scripts, css and html - correct?</li> <li>Once received, the browser then builds a Document Object Tree - is this when the DOM is ready or when it starts rendering elements on the page in a browser?</li> <li>In that regard, what is the difference between "when the DOM is loaded" and "when the DOM is ready"?</li> <li>Is there any difference between placing (java)script at the top (in the head tag) or at the bottom (before <code>&lt;/body&gt;</code> tag)?</li> <li>Is there an DOM event that fires when all assets (css, images, javascripts, etc) are <strong>fully</strong> loaded by the browser? I ask this as sometimes I might have a background image still being loaded by the browser, and well before it can complete, my Javascript animations already start executing.</li> </ol> <p>Thank you for taking the time to read this, and i look forward to your responses!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload