Copies a string to the clipboard.
Uses navigator.clipboard if available, otherwise falls back to a hidden textarea. Returns true if the operation succeeds, false otherwise.
navigator.clipboard
true
false
Text to copy to clipboard.
true if successful, false otherwise.
await copyToClipboard("Hello, world!"); Copy
await copyToClipboard("Hello, world!");
1.2.0
Copies a string to the clipboard.
Uses
navigator.clipboardif available, otherwise falls back to a hidden textarea. Returnstrueif the operation succeeds,falseotherwise.