![Thomas Steiner](https://web.dev/images/authors/thomassteiner.jpg) Thomas Steiner [GitHub](https://github.com/tomayac) [LinkedIn](https://www.linkedin.com/in/thomassteinerlinkedin) [Mastodon](https://toot.cafe/@tomayac) [Bluesky](https://bsky.app/profile/tomayac.com) [Homepage](https://blog.tomayac.com/)


Published: April 30, 2025

<br />

Celebration: This web feature is now available in all three major browser engines, and becomes Baseline Newly available as of March 30, 2025.

<iframe src="https:///frame/blog/baseline-clipboard-item-supports/index_b70381eef29450ebd3c3537b143b5cc906d9c0ed5dcc297b76b22e00d83c18b9.frame" class="framebox inherit-locale " allow="clipboard-write https://" allowfullscreen is-upgraded></iframe>

The Async Clipboard API has made working with the clipboard a lot easier than it used to be in the past. In lieu of previous methods for managing the clipboard, you can now call [`navigator.clipboard.writeText()`](https://developer.mozilla.org/docs/Web/API/Clipboard/writeText) for plain text content or [`navigator.clipboard.write()`](https://developer.mozilla.org/docs/Web/API/Clipboard/write) for "almost" everything else like images, textual content, or HTML.

One missing piece so far, though, was quantifying the "almost". For example, you couldn't know if the API supported SVG until you tried, and then, in case of non-support, caught the exception that was thrown. This wasn't a very ergonomic way to determine support, which is why the static [`ClipboardItem.supports()`](https://developer.mozilla.org/docs/Web/API/ClipboardItem/supports_static) function was specified.

The function has now reached Baseline Newly available status, which means working with the clipboard becomes even better. To know if a browser supports a given format, pass the MIME type of the format you're interested in to the function.

```javascript
const format = 'image/svg+xml';
const supportsFormat = ClipboardItem.supports(format);
console.log(`This browser does${supportsFormat ? '' : ' not'} support ${format}.`);
// "This browser does support image/svg+xml."
```

Before, I wrote "almost" *everything* else, and this is where it gets really interesting. [Web custom formats](https://developer.chrome.com/blog/web-custom-formats-for-the-async-clipboard-api) allow you to work with formats the browser doesn't natively support. For example, by default, the browser doesn't support AVIF images.

```javascript
const format = 'image/avif';
const supportsFormat = ClipboardItem.supports(format);
console.log(`This browser does${supportsFormat ? '' : ' not'} support ${format}.`);
// "This browser does not support image/avif."
```

But by using web custom formats, you can work with AVIF images and copy and paste them around freely, as long as the receiving party also knows how to deal with the web custom format.

```javascript
const format = 'web image/avif';
const supportsFormat = ClipboardItem.supports(format);
console.log(`This browser does${supportsFormat ? '' : ' not'} support ${format}.`);
// "This browser does support web image/avif."
```

Thanks to the `ClipboardItem.supports()` function, you can now properly detect the clipboard support situation for web custom format as well and be sure it works.

> [!NOTE]
> **Note:** You still need to wrap the `navigator.clipboard.write()` call in a `try..catch` block, as it could throw a `NotAllowedError` `DOMException`. This isn't related to support for the format, but, for example, a not granted clipboard permission.

```javascript
if (ClipboardItem.supports('web image/avif')) {
  // Fetch remote AVIF image and obtain its blob representation.
  const blob = await fetch('image.avif').then((response) => response.blob());

  try {
    // Write the image data to the clipboard, prepending the blob's actual
    // type (`"image/avif"` with the string `"web "`, so it becomes
    // `"web image/avif"`.
    const clipboardItem = new ClipboardItem({
      'web image/avif': blob,
    });
    await navigator.clipboard.write([clipboardItem]);
  } catch (err) {
    console.error(err.name, err.message);
  }
}
```

With the `ClipboardItem.supports()` function now Baseline Newly available, web developers can reliably detect clipboard support for various MIME types, including web custom formats. This enhancement makes working with the clipboard more robust and predictable, improving the user experience across all browsers.