Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Script included at bottom of page in mvc 4 template

I was looking at the MVC 4 release candidate and the default Internet template that is included. I noticed that in the _Layout.cshtml, they are including the jQuery bundle at the bottom of the page:

        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

Is there a reason that the script was included at the bottom of the page instead of in the head section with the modernizr script? Are there any benefits to doing it either way? I was always under the impression that you should include your scripts in the head section.

like image 848
Dismissile Avatar asked Jul 11 '12 16:07

Dismissile


1 Answers

This is generally done for performance. Look at the Yahoo performance guidelines.

http://developer.yahoo.com/performance/rules.html/

They explain why scripts can be better at the bottom.

like image 74
BZink Avatar answered Sep 21 '22 01:09

BZink