Hi,
Just wondering why javascript files included using
Requirements::javascript('...')
get inserted before </body>
and not in <head>
.
Just curious if there are any advantages of one method over the other.
Thanks.
VWD
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi,
Just wondering why javascript files included using
Requirements::javascript('...')
get inserted before </body>
and not in <head>
.
Just curious if there are any advantages of one method over the other.
Thanks.
VWD
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
Great - thanks very much for that Nathan. I understand now.
VWD.