Mathias Bynens 9/14/2010

Using `setTimeout` to speed up `window.onload`

Read Original

This technical article investigates why wrapping code, like the Google Analytics snippet, in a setTimeout with 0ms delay can speed up the window.onload event. It explains JavaScript's blocking behavior and how setTimeout allows the parser to continue, using detailed test cases with and without external resources like images to illustrate the timing nuances.

Using `setTimeout` to speed up `window.onload`

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week