You will be warned in such a situation while using the Google DevTools console. This warning is as follows:
[Violation] Avoid using document.write().
Firefox DevTools provides similar feedback:
An unbalanced tree was written using document.write() causing data from the network to be reparsed.
When Google Lighthouse encounters this situation, it flags the page in question:
Lighthouse also removes the warning if different commands are used to provide the same function instead of such a command.
How to pass the audit? – Avoiding document.write()
You need to delete all
document.write () snippets in HTML code. You can do the same by using the asynchronous loading function instead.
Test Your Website Performance!
You can quickly analyze your site in a minute