21307 Posts in 5737 Topics by 2603 members
General Questions
SilverStripe Forums » General Questions » Why do javascript files get inserted before </body> and not within <head>
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 726 Views |
-
Why do javascript files get inserted before </body> and not within <head>

28 March 2011 at 6:28pm
Hi,
Just wondering why javascript files included using
get inserted beforeRequirements::javascript('...')
and not in</body>
.<head>
Just curious if there are any advantages of one method over the other.
Thanks.
VWD -
Re: Why do javascript files get inserted before </body> and not within <head>

28 March 2011 at 8:47pm
It's considered best practice: putting the .js files at the bottom of the page makes them download last which increases overall page loading speed. Check out http://developer.yahoo.com/performance/rules.html#js_bottom
-
Re: Why do javascript files get inserted before </body> and not within <head>

28 March 2011 at 10:45pm
Great - thanks very much for that Nathan. I understand now.
VWD.
| 726 Views | ||
|
Page:
1
|
Go to Top |


