Clipboard (Copy & Paste)

The Clipboard API gives web applications a way to react on cut, copy and paste operations performed by the user as well as read from or write to the system clipboard directly on behalf of user.

API glimpse

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.

Resources