Clipboard API
The Clipboard API is a replacement for the deprecated document.execCommand() and is currently under development. It allows for advanced features like customized content and multi-format data support, enabling richer interactions.
The API enhances control and security by ensuring precise data transfer and protecting against unauthorized clipboard interference.
Inconsistent Support
In Safari, unsupported formats don't result in an error, and you can still proceed with copying text. However, Chrome and Firefox might throw an error when faced with unsupported formats.
Additionally, Safari and Firefox may prompt you before pasting text, whereas Chrome might request permissions only once.
Demo
You can use this demo to check what is supported by your browser.
Feature | Supported | Details |
ClipboardItem | ❔ | Supported by all modern browsers |
ClipboardItem (constructor) | ❔ | Copy stars to check if this feature is supported |
Static ClipboardItem.supports() | ❔ | — |
ClipboardItem.types() | ❔ | Copy and paste stars to check if this feature is supported |
Multiple items | ❔ | Copy stars to check if this feature is supported |
image/svg+xml | ❔ | Copy and paste stars to check if this feature is supported |
Custom web formats | ❔ | Copy and paste stars to check if this feature is supported |
presentationStyle | ❔ | Copy and Paste stars to check if this feature is supported |