clipboard write blocked JavaScript Origin: On your device Last updated 14 Oct 2026

NotAllowedError: Failed to execute 'writeText' on 'Clipboard': Document is not focused.

The Clipboard API refused to write — the page isn’t focused, there was no user gesture, or the context isn’t secure.

Exact message you may see Document is not focusedCannot read properties of undefined (reading 'writeText')
Seen on: JavaScript

Meaning

navigator.clipboard requires HTTPS (or localhost), a focused document and usually a user gesture. It’s undefined on plain HTTP.

Common causes

  • Page served over HTTP (navigator.clipboard undefined)
  • Called without a click
  • DevTools focused instead of the page
  • Iframe without clipboard-write permission

⚡ Quick fix

  1. Serve over HTTPS
  2. Call from a click handler
  3. Add allow="clipboard-write" on iframes
  4. Fall back to document.execCommand('copy')

Detailed fix by platform

JavaScript

  1. button.addEventListener('click', () => navigator.clipboard.writeText(text));

How to diagnose

  1. Context — HTTPS?
  2. Gesture — Triggered by a click?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

0x80070005 — Windows Error 0x80070005 (E_ACCESSDENIED): Access is denied (Windows)0x80070005403 — HTTP 403 Forbidden (HTTP)403AADSTS65001 — AADSTS65001: The user or administrator has not consented to use the application (Azure)AADSTS65001Access to the path is denied — System.UnauthorizedAccessException: Access to the path 'x' is denied (.NET)Access to the path is…AccessControlListNotSupported — AccessControlListNotSupported: The bucket does not allow ACLs (AWS)AccessControlListNotS…auth/popup-closed-by-user — Firebase Auth: auth/popup-closed-by-user / auth/popup-blocked / auth/cancelled-popup-request (Authentication)auth/popup-closed-by-…daemon — Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? (Docker)daemonERR_ABORTED — net::ERR_ABORTED 404 (Not Found) (JavaScript)ERR_ABORTEDclipboard…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.