Does javascript have to be in the head tags?

后端 未结 11 696
逝去的感伤
逝去的感伤 2020-11-27 03:46

I believe javascript can be anywhere (almost), but I almost always see it in between . I am using jquery and wanted to know if it has

11条回答
  •  情深已故
    2020-11-27 04:30

    Basically, browsers stop rendering page until .js files are completely downloaded and processed. Since they render page progressively as HTML arrives, the later .js files are referenced, the better user experience will be.

    So the trick is to include only absolutely crucial scripts in the head, and load remaining ones towards the end of the page.

提交回复
热议问题