[nycphp-talk] JavaScript just above form in body?
Rahmin Pavlovic
rahmin at insite-out.com
Thu Feb 7 12:00:12 EST 2008
Michael B Allen wrote:
> Is it considered bad practice to emit scripts within the body of a
> page such as immediately preceeding the form that uses it? It seems to
> work fine but from looking at some random sites I have yet to see an
> example of this. Logically it makes sense to put the JavaScript close
> to where it will be used no?
>
That actually makes perfect sense in terms of download speed. It became
somewhat of a standard practice to include JS in the HEAD of the document,
but that actually slows things down.
I actually wrote about this and a bunch of other JS optimization tricks in
my well-ignored Wordpress blog (primarily ignored by me):
http://insite-out.com/#load-scripts-last
More information about the talk
mailing list