Clipboard API
ELI5 — The Vibe Check
The Clipboard API lets your website read from and write to the user's clipboard — copy and paste, but controlled by code. The 'Copy to clipboard' button on code snippets? That's this API. Simple, useful, and makes you feel like a wizard the first time it works.
Real Talk
The Clipboard API provides async methods for reading and writing text and rich content to the system clipboard. navigator.clipboard.writeText() is widely supported; readText() requires explicit permission. It replaces the deprecated document.execCommand('copy') approach.
Show Me The Code
async function copyToClipboard(text) {
await navigator.clipboard.writeText(text);
showToast('Copied!');
}
When You'll Hear This
"Add a copy button using the Clipboard API for the API key display" / "Reading from clipboard requires permission — writing is allowed from user-initiated events"
Related Terms
Notification API
The Notification API lets websites show native system notifications — those little pop-ups in the corner of your screen.
Progressive Web App
A PWA is a website that put on a trench coat and convinced your phone it's a real app.
Web Share API
The Web Share API triggers the native share sheet from a website — the same one native apps use.