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.
Documentation Clipboard by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Methods
read():Promise<DataTransfer>
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.
Throws:
null | DOMError |
---|
readText():Promise<String>
Requests text from the system clipboard; returns a Promise
which is resolved with a DOMString
containing the clipboard's text once it's available.
Throws:
null | DOMError |
---|
write(data:DataTransfer):Promise<Void>
Writes arbitrary data to the system clipboard. This asynchronous operation signals that it's finished by resolving the returned Promise
.
Throws:
null | DOMError |
---|