# Why document.write is slow and how to replace it

> document.write blocks parsing and Chrome may ignore it on slow connections. Insert elements with DOM methods instead.

Best practices · HTML version: https://getreport.app/learn/document-write

## document.write() usage

Passing looks like: document.write() is not used.

**Why it matters.** document.write blocks the page until the injected script arrives, and Chrome drops such scripts on slow connections, so the ad or widget simply does not appear.

**How to fix it.**

1. Replace document.write with a normal <script async> tag or by appending the element from JavaScript.
2. Update the ad or widget snippet; most vendors now provide an async version.

Check your own page: https://getreport.app/
