2009/11/30 breadwild <breadw...@gmail.com>:
> I have seen several examples on jQuery plugin sites that have the
> <script> tag and Javascript within the <body> and not the <head> where
> I thought it was supposed to go.

It's a matter of performance. Put your CSS as close to the top of the
<head> as possible, and put your JavaScript as close to the bottom of
the <body> as possible.

This is because browsers try to load everything in parallel but block
while loading, compiling and executing JavaScript (because it could
potentially alter the following HTML - e.g. using document.write). You
can try to work around this but if you just want to include <script>
tags in your HTML without any fancy tricks to load scripts using
iframes or xhr evals or injections then move your <script> tags to the
bottom of your page.

Rafał Pocztarski

Reply via email to