Consider the following document
<html>
<body>
This is some content
<script type="text/javascript" src="verySlowToRespond.js"></script>
This is some more content
</body>
</html>
I’d like first to check my assumption that it is unsafe for the browser to parse beyond the script tag until the script has loaded and executed.
This means that (if my assumption is correct), say verySlowToRespond.js takes 20 seconds to respond, the page DOM cannot be fully assembled until this dependency is resolved.
Supposing verySlowToRespond.js hung about indefinitely? At what point would the browser give up and continue with the parse?
Correct: the browser won’t continue beyond the script tag until it’s read and evaluated it.
The browser gives up based on the same timeout rules it uses for pages. It depends on the browser, and on the exact nature of the timeout.
I’m wondering why there’d be such a thing as a slow-to-respond script. Is there something wrong with your hosting? Is the script slow to respond, or does it load and then take a really long time to run?