Skip to content

24 ways to impress your friends

Vote up?

Jason Karns

I’m quite surprised by the number of comments who think that JavaScript execution is delayed until the page is fully loaded. JavaScript is downloaded, parsed, and executed at the very location it is referenced in the page. It is for this very reason that many performance-minded people tell you to place your scripts at the bottom of the page; because they BLOCK loading of the page while they are downloaded and executed. It is this very problem of waiting for the DOM to be ready in order to execute DOM-dependent code that so many JS frameworks solve with OnDomReady events and other onload hacks.

It is perfectly acceptable (from a performance standpoint) to use JS as your redirection method.