I hate browsers!

From: Peter (BOUGHTONP)21 Jul 2011 16:17
To: af (CAER) 27 of 30
quote:
Also, you should put script tags at the end of the document, just before the closing body tag, as they block page rendering until the files they reference have been loaded and parsed.


Alternatively, you should put script tags in the head of the document because they block page rendering until the files they reference have been loaded and parsed, and that means you don't get a page that has rendered but is buggy and unresponsive because only half the scripts have loaded. :@
From: af (CAER)21 Jul 2011 16:18
To: ANT_THOMAS 28 of 30
I've also updated it so it will still work even if you put the script tags in the head and use the no_wait option; in such a case it'll just pretend you didn't use no_wait.
From: Peter (BOUGHTONP)21 Jul 2011 16:23
To: ANT_THOMAS 29 of 30
It's not your fault!

The head is where script files have always been intended to go - the blocking of loading is deliberate. It's a relatively recent fad of "optimising" pages by putting them at the end.

As above, it means that the page can load and look like it's ready before any of the JavaScript is actually executed, which is especially a pain when people use files on a slow CDN, and you have to sit waiting before you can interact with a page.
EDITED: 21 Jul 2011 16:24 by BOUGHTONP
From: af (CAER)21 Jul 2011 16:40
To: Peter (BOUGHTONP) 30 of 30
It wouldn't be a problem if document.write() never existed :-/