Lighthouse flags calls to document.write()
that weren't blocked by Chrome:
For the most problematic uses, Chrome will either block calls to document.write()
or emit a console warning about them, depending on the user's connection speed. Either way, the affected calls appear in the DevTools Console. See Google's Intervening against document.write()
article for more information.
Lighthouse reports any remaining calls to document.write()
because it adversely affects performance no matter how it's used, and there are better alternatives.
Each Best Practices audit is weighted equally in the Lighthouse Best Practices Score. Learn more in The Best Practices score.
document.write()
#Remove all uses of document.write()
in your code. If it's being used to inject third-party scripts, try using asynchronous loading instead.
If third-party code is using document.write()
, ask the provider to support asynchronous loading.
document.write()
auditdocument.write()