Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature detection of web custom format support #201

Closed
DavidMulder0 opened this issue Dec 8, 2023 · 1 comment
Closed

Feature detection of web custom format support #201

DavidMulder0 opened this issue Dec 8, 2023 · 1 comment

Comments

@DavidMulder0
Copy link

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

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.

@DavidMulder0
Copy link
Author

Duplicate of #170 , apologies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant