Unless your page loads really slowly, I've found that the javascript delay 
is almost non-existent.

On Monday, November 7, 2011 8:06:57 AM UTC-5, Lasse Reichstein wrote:
>
> The defer attribute tells the browser that the script doesn't have to
> be run immediately (i.e., it doesn't use document.write). That means
> that it can start fetching the script immediately when it sees the
> script tag *and* continue parsing the document.
>
> Without the defer attribute, the browser must stop parsing the
> document until the script has completed loading and been run, because
> the script might use document.write to change how the parsing should
> continue.
>
> If you put the script at the end of the body, the browser won't start
> fetching it until it has parsed the script tag. That introduces an
> extra delay before the script is ready and run - the time it takes to
> parse the document and create the DOM for it.
>
> By putting the script tag early but with the defer attribute can
> reduce the latency of your page - the time it takes before the onload
> event fires - by fetching over the network (or even from local cache),
> which is I/O bound, while it parses the document (which is memory/CPU
> bound).
>
> But then, AFAIK, not all browsers handle the defer attribute the way
> it was intended, so it's no panacea.
>
> /L
>
>
>

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to