[w3c/clipboard-apis] Feature detection of web custom format support (Issue #201)

Could we either allow

- a way to feature detect the support for specific mime types in write operations
- OR quietely ignore unsupported mime types as long as one is supported during a write operation

I was using the following code for mime type support feature detection

```javascript
const isSupported = async (type) => {
        try {
          await navigator.clipboard.write([
            new ClipboardItem({
              [type]: new Blob(["test content for " + type], { type }),
            }),
          ]);
          return true;
        } catch (e) {
          return false;
        }
};
```

but this causes issues in Chrome and Edge: https://bugs.chromium.org/p/chromium/issues/detail?id=1509827

Additionally writing to the clipboard just to see whether it will fail is... not pretty. 

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/clipboard-apis/issues/201
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/clipboard-apis/issues/201@github.com>

Received on Friday, 8 December 2023 12:55:33 UTC