将javascript放在标题之外有多糟糕? [英] How bad is it to put javascript outside of the header?
问题描述
这个问题已经说明了一切。
The question pretty much already says everything.
我开始向我的周末项目</a>。这是一个小应用程序给我和几个朋友,因为我们是交换学生,它对我们有用。
I'm starting to add some features to my weekend project. It's a small app for me and a couple of friends, as we're exchange students it's kinda useful for us.
但事情是以下,我做这在PHP和结构化一切与包括所以我可以得到代码分离。这些代码段中的一些依赖于javascripts snipets,所以它是多么糟糕的把JavaScript放在身体的中间?
But the thing is the following, I'm doing this in php and structuring everything with includes so i can get the code separated. Some of these pieces of code are dependent on javascripts snipets, so how bad is it to put a javascript in the middle of the body? Or should i just make double includes so the javascript stays in the header?
推荐答案
这是不错的。
It's actually considered good practice to put your script tags as late as possible in the page.
这篇关于将javascript放在标题之外有多糟糕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!