Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
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.