Don't miss out on the action at this year's Chrome Dev Summit, happening on Oct 23rd and 24th. Learn more.

Avoids document.write()

Why the audit is important

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.

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

How to pass the audit

In your report, Lighthouse lists out every call to document.write(). Review this list, and note any call that dynamically injects a script. 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.

How the audit is implemented

This section explains how this audit is implemented, so that you can understand how the audit's score is calculated.

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

Feedback