demo · v132

Async Clipboard Playground

Chrome 132 allows constructing a ClipboardItem with a Promise<string> instead of requiring a resolved string upfront. This unlocks clipboard writes that include async work — like fetching content or awaiting user input — without triggering the "write must be called in user-gesture handler" restriction.

Checking Clipboard API support…
Immediate string copy works pre-132
Classic synchronous copy — a resolved string passed directly to ClipboardItem.
Promise<string> copy Chrome 132
Passes a Promise to ClipboardItem. The clipboard write starts immediately (within the gesture handler), but the data is resolved asynchronously.
Fetch → copy Chrome 132
Fetch plain text from a URL, then put it on the clipboard — all deferred via a Promise inside ClipboardItem.
Read clipboard reference
Read back whatever is currently on the clipboard to verify the previous copy operations worked.
Event timeline
Actions logged here…
// Before Chrome 132: must have a resolved string
navigator.clipboard.write([
  new ClipboardItem({
    'text/plain': 'some text'  // ← must be resolved already
  })
]);

// Chrome 132: ClipboardItem accepts Promise<string>
// The write() call starts within the user gesture,
// but the data is allowed to be pending
navigator.clipboard.write([
  new ClipboardItem({
    'text/plain': new Promise(async (resolve) => {
      const data = await fetch('/api/clipboard-content').then(r => r.text());
      resolve(data);
    })
  })
]);
// ↑ No "not allowed outside user gesture" error!

see also