【发布时间】:2017-07-06 15:48:25
【问题描述】:
在与同事讨论后,我们需要一个问题的答案:页脚中的脚本是否“阻止渲染”?我的意思是,在脚本完全加载之前是否向用户显示了任何内容?
谢谢
【问题讨论】:
-
是的,它正在阻塞。但是(body)之前的部分已经渲染好了
-
我会说任何不是 inline 或 asyc/deferred 的 JS 都是渲染阻塞的。
-
Benefits of loading JS at the bottom as opposed to the top of the document 的可能重复项 - 此外 jQuery 可能最好放在顶部,因为其他脚本可以立即使用它
-
@Fran 我不确定它们是否相同。一个是讨论好处,另一个是要求定义。
-
@evolutionxbox - 我以为它回答了这个问题
If I put it in the footer, will rendering start before the script finishes downloading?
标签: javascript html rendering