Page uses document.write()

For users on slow connections, such as 2G, 3G, or slow Wi-Fi, external scripts dynamically injected via document.write() can delay the display of main page content by tens of seconds. Lighthouse lists out every call to document.write():

Lighthouse audit showing usage of document.write
Page uses document.write().

See Intervening against document.write() to learn more.

How this audit fails

Lighthouse reports every instance of document.write() that it encounters. Chrome's intervention against document.write() only applies to render-blocking, dynamically-injected scripts. Other uses of document.write() may be acceptable.

Each Best Practices audit is weighted equally in the Lighthouse Best Practices Score. Learn more in The Best Practices score.

Avoid document.write()

Review the usage of document.write(). If the script meets the criteria outlined in the introduction to Intervening against document.write(), Chrome won't execute the injected script. These are the calls to document.write() that you want to change.

See How do I fix this? for possible solutions.

More information

Page uses document.write() audit source

Last updated: Improve article