3 ms·
Did I miss something, or why are these in your head tag? Why not put them in the body tag so they don't load until after the browser has rendered the page?
by cont4gious 16y ago
Did I miss something, or why are these in your head tag? Why not put them in the body tag so they don't load until after the browser has rendered the page?
- jasondavies 16y agoGood point, but you'll still benefit from using async script loading if you have multiple third-party scripts loading at the end of your page. If the Twitter script is included before the others, and it lags, it will hold them up too.
- rarestblog 16y agoSorry, but you aren't right. Those are mostly located in body tag. They are requested as soon as encountered by browser, because they might issue "document.write", so the execution of rest of HTML is delayed until that "src" is loaded. That's exactly what causes the problem. Putting script into body doesn't defer its execution. I'm not sure how browsers render <script src in head, but probably the same.
- cont4gious 16y agooh, ok, thanks! i would have made the assumption that this would have fixed it and been frustrated.
- briancray 16y agoWorks same in the head. All scripts if not set to asynchronous will prevent further rendering of the page until the script has finished loading and running.