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:

enter image description here

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:

enter image description here

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

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -