A couple of weeks ago, I attended a talk by Steve Souders
http://stevesouders.com/
He is "Chief Performance Yahoo!" He has a new book coming out about
performance on the web.

One of his points was to include Javascript at the bottom of the page. But
even he admitted that this is not practical in many cases. Basically, if you
can wait to load a script at the bottom of the page or dynamically load it,
that is better. But often times you just can't

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Fil
Sent: Monday, July 16, 2007 10:06 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: dev tip: combining JS script files


> This is a good page on optimzing javascript for speed...
>
> http://betterexplained.com/articles/speed-up-your-javascript-load-time/

This part of the text seems contradictory with jQuery's habits. Why do
we load jQuery.js and all its plugins in the <head> section? (answer:
to have .ready()). But should we do it all the time and for all
plugins?


Optimize Javascript Placement

Place your javascript at the end of your HTML file if possible. Notice
how Google analytics and other stat tracking software wants to be
right before the closing </body> tag.

This allows the majority of page content (like images, tables, text)
to be loaded and rendered first. The user sees content loading, so the
page looks responsive. At this point, the heavy javascripts can begin
loading near the end.

I used to have all my javascript crammed into the <head> section, but
this was unnecessary. Only core files that are absolutely needed in
the beginning of the page load should be there. The rest, like cool
menu effects, transitions, etc. can be loaded later. You want the page
to appear responsive (i.e., something is loading) up front.


-- Fil

Reply via email to