JQuery Script is included at the bottom of the page in the mvc 4 template

I watched the candidate for the release of MVC 4 and the standard Internet template included in it. I noticed that in _Layout.cshtml they include the jQuery package at the bottom of the page:

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

Is there a reason the script was included at the bottom of the page, and not in the header section using modernizr script? Are there any benefits to this? It always seemed to me that you should include your scripts in the chapter section.

+5
source share
3 answers

This is usually done for performance. Look at Yahoo's performance guidelines.

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

They explain why the scenarios may be better below.

+7
source

, jquery ui, jquery jquery-ui . , .

, jquery , .

+1

I can’t answer specifically for this case, but the idea, as a rule, is that the browser tries to make the page approximately in the order of the document. Having the most recently included scripts means that the rendering can do its job and display the static parts of the page, and then the scripts are loaded. I could not give specific data on how this really affects the user interface, but the idea is to make it so that the page is viewable before the scripts have finished loading.

0
source

All Articles