document.write()

bp/document-writewarningperformancelighthouse

Why it matters

document.write blocks parsing, and Chrome skips it on slow connections (Lighthouse: uses document.write()).

Fix

Insert elements with DOM APIs, or load scripts with next/script.

Credit

  • From Google Chrome

    Lighthouse flags document.write() because it delays page load and Chrome blocks it on slow connections.

References