jQuery脚本包含在MVC 4模板页底部 [英] jQuery Script included at bottom of page in mvc 4 template

查看:100
本文介绍了jQuery脚本包含在MVC 4模板页底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找在MVC 4候选发布版和所包含的默认Internet模板。我注意到,在_Layout.cshtml,他们包括在页面底部的jQuery的软件包:

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>

有没有脚本被包括在页面,而不是与Modernizr的脚本头部分底部的原因是什么?在那里做任何一种方式的好处是什么?我总是在IM pression,你应该包括头部分脚本下。

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.

推荐答案

这是一般性能完成。看看雅虎业绩指引。

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

<一个href=\"http://developer.yahoo.com/performance/rules.html/\">http://developer.yahoo.com/performance/rules.html/

他们解释为什么脚本可以在底部更好。

They explain why scripts can be better at the bottom.

这篇关于jQuery脚本包含在MVC 4模板页底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆