Reputation: 9570
I read this :
The browser retrieves all resources requested in the <head>
section of the HTML before it starts rendering the <body>
. If you place the requests in the <body>
section instead, then the page rendering and downloading resources can happen in parallel. You should move as many resource requests as you can from the <head>
section to the <body>
the HTML specification calls for <link>
and <style>
tags the be in <head>
, but browsers do not enforce this
Before I go ahead and take the advice from the author of this book - I am curious if this is true that all modern - commonly used browsers don't enforce where the links are , and also if doing this will cause any other problems that I do not know about
Upvotes: 2
Views: 289
Reputation: 2339
I would follow the spec. An invalid document will render in unpredictable ways. By all means put your scripts in the body, right before end body tag. But keep the link and style inside the head.
When in doubt follow the specs.
Upvotes: 0
Reputation: 5145
It is true to some extent. Run YSlow on your page, it will tell many optimization techniques applicable to your page.
http://developer.yahoo.com/performance/rules.html
Upvotes: 1
Reputation: 8770
Taken From (Read it!):
http://developer.yahoo.com/performance/rules.html
Put Stylesheets at the Top
While researching performance at Yahoo!, we discovered that moving stylesheets to the document HEAD makes pages appear to be loading faster. This is because putting stylesheets in the HEAD allows the page to render progressively.
Put Scripts at the Bottom
The problem caused by scripts is that they block parallel downloads. The HTTP/1.1 specification suggests that browsers download no more than two components in parallel per hostname. If you serve your images from multiple hostnames, you can get more than two downloads to occur in parallel. While a script is downloading, however, the browser won't start any other downloads, even on different hostnames.
Upvotes: 7