Clipboard

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The Clipboard interface of the Clipboard API provides read and write access to the contents of the system clipboard. This allows a web application to implement cut, copy, and paste features.

EventTarget Clipboard

The system clipboard is exposed through the global Navigator.clipboard property.

All of the Clipboard API methods operate asynchronously; they return a Promise which is resolved once the clipboard access has been completed. The promise is rejected if clipboard access is denied.

All the methods require a secure context. Additional requirements for using the API are discussed in the Security consideration section of the API overview topic.

Instance methods

Clipboard is based on the EventTarget interface, and includes its methods.

read()

Requests arbitrary data (such as images) from the clipboard, returning a Promise that resolves with an array of ClipboardItem objects containing the clipboard's contents.

readText()

Requests text from the system clipboard, returning a Promise that is fulfilled with a string containing the clipboard's text once it's available.

write()

Writes arbitrary data to the system clipboard, returning a Promise that resolves when the operation completes.

writeText()

Writes text to the system clipboard, returning a Promise that is resolved once the text is fully copied into the clipboard.

Specifications

Specification
Clipboard API and events
# clipboard-interface

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Clipboard
read
formats.unsanitized parameter
Experimental
readText
Supports image/png MIME type
Supports text/html MIME type
Supports text/plain MIME type
write
writeText

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.
See implementation notes.

See also