Is it practically good to put JS files at the bottom of webpage?

前端 未结 7 1477
情歌与酒
情歌与酒 2020-12-18 03:26

It is widely recommended that JS files should be put at the bottom of page to allow html codes to be loaded first. In this case, visitors will see something when waiting for

7条回答
  •  没有蜡笔的小新
    2020-12-18 03:40

    Script tags in the header block all other requests. If you have let's say 10 tags like this:

    ...they will be executed sequentially. No other files will concurrently be downloaded. Hence they increase page load time.

    Check out HeadJS here as a sample solution.

提交回复
热议问题