The classic copy button. Real navigator.clipboard.writeText() — try it, then paste anywhere (Ctrl/Cmd+V) to confirm. The "Copied!" state is essential UX.
npm install w3tweaks
Or copy your own text:
Draw on the canvas, then copy it as a PNG. Uses canvas.toBlob() → new ClipboardItem({'image/png': blob}) → clipboard.write(). Paste into an image editor or doc to confirm.
Reading is more restricted than writing (permission prompt, focus required). Click to read text, or paste an image into the drop zone with Ctrl/Cmd+V.
clipboard-read permission doesn't exist in Firefox/Safari. Never read on page load.
A single ClipboardItem can carry both text/html and text/plain. Rich editors get the HTML; plain fields get the text. Copy below, then paste into a rich editor vs a plain text field.
Pick a browser engine to simulate. The left awaits a fetch before write() (breaks activation in Safari). The right passes a promise as the ClipboardItem value (works everywhere).