I have nothing on a page except the following:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script>
$(function() {
document.write('foo');
});
<script>
When I run this page in firefox the loading indicator in the current browser tab seems to be in perpetual motion, never stopping. Why does this happen? Is it indicating that the document.write script runs ceaselessly?
You need to close the document after you’ve written to it:
Otherwise the browser still has the document in an “open-for-writing” state, hence the loading indicator.
(Also, as @DaveRandom points out in his comment, you need close your
<script>properly with</script>.)