HTML 5 clipboard copy/paste

Date: 2020-01-15

https://whatwebcando.today/

https://whatwebcando.today/clipboard.html

// Older, synchronous API:

document.addEventListener('cut/copy/paste', listener)
//    An event fired when the user invoked the particular clipboard operation (either cut, copy or paste).
event.clipboardData.setData('text/plain', data)
//    Sets the data that is to be written to the clipboard by the cut or copy operations in the specified format.
event.clipboardData.getData('text/plain')
//    Returns the data that has been read from the clipboard by the paste operation in the specified format.
document.execCommand('cut/copy/paste')
//    Programatically invokes the specified clipboard operation (either cut, copy or paste) on the data or element currently having a focus.

// Newer, asynchronous API:

navigator.clipboard.writeText(text)
//    Writes the data to the clipboard. Returns a Promise resolved when the operation has succeeded.
navigator.clipboard.readText()
//    Returns a Promise resolved with the data read from the clipboard. 
31300cookie-checkHTML 5 clipboard copy/paste