Why Do Inline Scripts Block Rendering When Put At The Bottom Of A Page?
I read High Performance Web Sites: Essential Knowledge for Front-End Engineers and in it the author suggests that all JavaScript code should be externalized and put at the bottom
Solution 1:
In the inline script, the time is taken up running the script, which might change the DOM. Trying to render the DOM while it's mutating is a recipe for a mess. So rendering only happens at points when the JS is stalled, and therefore the DOM is stable.
While waiting for an external script to download, the running of scripts is stalled, so the DOM can be rendered safely. The downloaded JS won't be run until the rendering is complete.
Post a Comment for "Why Do Inline Scripts Block Rendering When Put At The Bottom Of A Page?"