Skip to main content
All rules

PERF-009

Inline script uses document.write()

LowDefault severity · Performance · SEO, quality and performance

Last reviewed

What it checks

Inline scripts calling document.write().

Why it matters

document.write blocks the page while it runs and Chrome blocks scripts injected this way on slow connections.

Recommended fix

Insert elements with DOM methods (appendChild) or load third-party tags asynchronously.

How to verify

Run Lighthouse and confirm no "Avoid document.write()" warning.

Example fix prompt

Generic prompt (your report adds the evidence)
Please fix this production issue in my app.

Issue PERF-009: Inline script uses document.write()
Site: https://your-app.example

First confirm the issue in the code or live config. If it is not present, say so and change nothing.
Task: Replace the document.write() calls in the inline scripts with createElement/appendChild, or load the third-party tag with async.

Constraints: make the smallest change that fixes this, keep the current design and behaviour, never paste secret values into code or chat, and tell me which files you changed.
Done when: Run Lighthouse and confirm no "Avoid document.write()" warning.

References