Aan deze vertaling wordt gewerkt.

The Clipboard interface implements the Clipboard API, providing—if the user grants permission—both read and write access to the contents of the system clipboard. The Clipboard API can be used to implement cut, copy, and paste features within a web application.

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

Calls to the methods of the Clipboard object will not succeed if the user hasn't granted the needed permissions using the Permissions API and the "clipboard-read" or "clipboard-write" permission as appropriate.

Note: In reality, at this time browser requirements for access to the clipboard vary significantly. Please see the section Clipboard availability for details.

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.

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. When the data has been retrieved, the promise is resolved with a DataTransfer object that provides the data.
readText()
Requests text from the system clipboard; returns a Promise which is resolved with a DOMString containing the clipboard's text once it's available.
write()
Writes arbitrary data to the system clipboard. This asynchronous operation signals that it's finished by resolving the returned Promise.
writeText()
Writes text to the system clipboard, returning a Promise which is resolved once the text is fully copied into the clipboard.

Clipboard availability

The asynchronous clipboard API is a relatively recent addition, and the process of implementing it in browsers is not yet complete. Due to both potential security concerns and technical complexities, the process of integrating this API is happening gradually in most browsers.

For example, Firefox does not yet support the "clipboard-read" and "clipboard-write" permissions, so access to the methods that access and change the contents of the clipboard are restricted in other ways. In addition, read() and write() are disabled by default and require changing a preference to enable them. Check the compatibility tables for each method before using it.

Specifications

Specification Status Comment
Clipboard API and events
The definition of 'Clipboard' in that specification.
Working Draft Initial definition.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome voor AndroidEdge MobileFirefox voor AndroidOpera voor AndroidSafari op iOSSamsung Internet
BasisondersteuningChrome Volledige ondersteuning 66Edge Geen ondersteuning NeeFirefox Volledige ondersteuning 63IE Geen ondersteuning NeeOpera Volledige ondersteuning 53Safari ? WebView Android Geen ondersteuning NeeChrome Android Volledige ondersteuning 66Edge Mobile Geen ondersteuning NeeFirefox Android Volledige ondersteuning 63Opera Android Volledige ondersteuning 53Safari iOS ? Samsung Internet Android ?
readChrome Geen ondersteuning NeeEdge Geen ondersteuning NeeFirefox Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Opmerkingen Currently works just like readText(); non-text content is not currently supported.
Uitgeschakeld From version 63: this feature is behind the dom.events.asyncClipboard.dataTransfer preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Geen ondersteuning NeeOpera Geen ondersteuning NeeSafari ? WebView Android Geen ondersteuning NeeChrome Android Geen ondersteuning NeeEdge Mobile Geen ondersteuning NeeFirefox Android Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Opmerkingen Currently works just like readText(); non-text content is not currently supported.
Uitgeschakeld From version 63: this feature is behind the dom.events.asyncClipboard.dataTransfer preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Geen ondersteuning NeeSafari iOS ? Samsung Internet Android ?
readTextChrome Volledige ondersteuning 66Edge Geen ondersteuning NeeFirefox Volledige ondersteuning 63
Opmerkingen
Volledige ondersteuning 63
Opmerkingen
Opmerkingen Firefox only supports reading the clipboard in browser extensions, using the "clipboardRead" extension permission.
IE Geen ondersteuning NeeOpera Volledige ondersteuning 53Safari ? WebView Android Geen ondersteuning NeeChrome Android Volledige ondersteuning 66Edge Mobile Geen ondersteuning NeeFirefox Android Volledige ondersteuning 63
Opmerkingen
Volledige ondersteuning 63
Opmerkingen
Opmerkingen Firefox only supports reading the clipboard in browser extensions, using the "clipboardRead" extension permission.
Opera Android Volledige ondersteuning 53Safari iOS ? Samsung Internet Android ?
writeChrome Geen ondersteuning NeeEdge Geen ondersteuning NeeFirefox Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Opmerkingen Currently works exactly like writeText(), including the availability limitations currently imposed by Firefox.
Uitgeschakeld From version 63: this feature is behind the dom.events.asyncClipboard.dataTransfer preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE Geen ondersteuning NeeOpera Geen ondersteuning NeeSafari ? WebView Android Geen ondersteuning NeeChrome Android Geen ondersteuning NeeEdge Mobile Geen ondersteuning NeeFirefox Android Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Volledige ondersteuning 63
Opmerkingen Uitgeschakeld
Opmerkingen Currently works exactly like writeText(), including the availability limitations currently imposed by Firefox.
Uitgeschakeld From version 63: this feature is behind the dom.events.asyncClipboard.dataTransfer preference (needs to be set to true). To change preferences in Firefox, visit about:config.
Opera Android Geen ondersteuning NeeSafari iOS ? Samsung Internet Android ?
writeTextChrome Volledige ondersteuning 66Edge Geen ondersteuning NeeFirefox Volledige ondersteuning 63
Opmerkingen
Volledige ondersteuning 63
Opmerkingen
Opmerkingen Writing to the clipboard is available without permission in secure contexts and browser extensions, but only from user-initiated event callbacks. Browser extensions with the "clipboardWrite" permission can write to the clipboard at any time.
IE Geen ondersteuning NeeOpera Volledige ondersteuning 53Safari ? WebView Android Geen ondersteuning NeeChrome Android Volledige ondersteuning 66Edge Mobile Geen ondersteuning NeeFirefox Android Volledige ondersteuning 63
Opmerkingen
Volledige ondersteuning 63
Opmerkingen
Opmerkingen Writing to the clipboard is available without permission in secure contexts and browser extensions, but only from user-initiated event callbacks. Browser extensions with the "clipboardWrite" permission can write to the clipboard at any time.
Opera Android Volledige ondersteuning 53Safari iOS ? Samsung Internet Android ?

Legenda

Volledige ondersteuning  
Volledige ondersteuning
Geen ondersteuning  
Geen ondersteuning
Compatibiliteit onbekend  
Compatibiliteit onbekend
Zie implementatieopmerkingen
Zie implementatieopmerkingen
Gebruiker moet deze functie expliciet inschakelen.
Gebruiker moet deze functie expliciet inschakelen.

Documentlabels en -medewerkers

Aan deze pagina hebben bijgedragen: mdnwebdocs-bot, delerioush
Laatst bijgewerkt door: mdnwebdocs-bot,