If you find the loading spinner in browser tab spinning forever, it might be due to the use of document.write()
.
Because document.write
is not just a standalone method, but part of a trio:
document.open(); document.write("Well written"); document.close();
And if close()
is not called at the end, the spinner will forever spin on.
To quote MDN’s docs: Writing to a document that has already loaded without calling document.open() will automatically call document.open. Once you have finished writing, it is recommended to call document.close()
to tell the browser to finish loading the page.
Read more here.