← Chrome 149 reference

v149 · clipboard api · covered on mdn

Selective Clipboard Format Read

Chrome 149 changes navigator.clipboard.read() to defer fetching clipboard data from the OS until ClipboardItem.getType() is called, rather than eagerly loading all available formats up front. No API changes — existing clipboard code benefits automatically. Ships in Chrome 149 on all platforms.

this API is documented on MDN

Clipboard: read() method — Web APIs | MDN Web Docs ClipboardItem: getType() method — Web APIs | MDN Web Docs

The Clipboard API shape is unchanged. MDN's Clipboard.read() and ClipboardItem.getType() pages document the full API. Chrome 149 browser-compat data will be reflected once MDN is updated.

what changed in Chrome 149

Before Chrome 149, calling navigator.clipboard.read() eagerly fetched all available clipboard formats from the OS at once — even if the page only needed one MIME type. For large clipboard payloads (for example, a 7 MB HTML blob alongside a plain-text representation), this meant the browser paid the full read cost on every read() call.

Chrome 149 changes this to a lazy model:

  1. clipboard.read() returns ClipboardItem objects immediately, with types populated but no format data loaded.
  2. Format data is fetched from the OS only when getType(mimeType) is called for a specific MIME type.
  3. Subsequent calls to getType() for the same type return cached results — the OS is not queried again unless the clipboard contents have changed.
  4. If the clipboard changes between read() and getType(), the getType() promise rejects rather than returning stale data.

In testing with a 7.7 MB clipboard payload (0.7 MB text + 7 MB HTML), selectively reading only the text reduced read time by 93% — from 179.5 ms to 10.8 ms.

Source: MSEdgeExplainers — SelectiveClipboardFormatRead/explainer.md.

existing code is unaffected

// This pattern works exactly as before — no code changes needed.
// Chrome 149 automatically defers loading 'text/html' until this line.
const items = await navigator.clipboard.read();
const item = items[0];

if (item.types.includes('text/html')) {
  const htmlBlob = await item.getType('text/html'); // data fetched here
  const html = await htmlBlob.text();
  console.log(html);
}

// If you only ever call getType('text/plain'), the HTML blob is never loaded.

at a glance

Shipped inChrome 149 (desktop, Android, WebView, iOS)
StatusEnabled by default
TypePerformance / behaviour change — no API additions
Specw3c/clipboard-apis PR #248
ChromeStatus5203433409871872 — Selective Clipboard Format Read

references