javascript - Script element block in head but don't block in body -
i use cuzillion build page script element in head:
<head> <script></script> </head> <body> <img /> <img /> <img /> <img /> </body>
this script element load 2 second delay, , need 3 second execute. when load page in chrome, network show net status:
obviously load script block parser parse images in body. images have load after script have been loaded
(may mentioned there image loaded in advance. think because webkit preloader
triggered).
however, when move script body,
<body> <img/> <img/> <script></script> <img/> <img/> </body>
it doesn't block image load under it:
but why? why script block in head not in body? what's differences?
if sourcing external script, can use async attribute tell browser fetch in parallel.
Comments
Post a Comment