Scripts should be included in the <head>
part is what I learned from w3c.
Why does Boostrap suggest to load itself in the <body>
part as seen here:
Scripts should be included in the <head>
part is what I learned from w3c.
Why does Boostrap suggest to load itself in the <body>
part as seen here:
从技术上讲,脚本应该在它们放置在正文中的位置加载和执行。想象一下,您的浏览器从上到下读取您的 HTML。如果脚本包含在文档的顶部,则浏览器在从 Web 服务器获取脚本时应该处于空闲状态。
Unobtrusive
JavaScript: <script> 在 HTML 代码的顶部还是底部?
如果加载脚本位于 body 标记的底部,那么它将最后加载,使页面的其余部分看起来好像加载得更快
这真的取决于你的页面。如果您的页面在向用户显示之前需要 js 才能工作,那么在向用户显示 html 之前加载它们会更明智