Javascript Reference
Categories: oncopy

javascript oncopy Description

@April 25, 2008, 8 a.m.
oncopy Firefox/Netscape/NN n/a IE 5(Win) Chrome/Safari/DOM n/a  


Bubbles: Yes; Cancelable: Yes  

Fires after the user initiates the Copy command (via the Edit menu, a keyboard shortcut, or a context menu) to place a copy of the selected content into the system clipboard. An event handler function for this event can supplement the copy action by placing additional data of your choice into the clipboardData object (which the onpaste event handler can read and handle as needed).


To give users access to a Copy menu command for an otherwise uneditable element, set event.returnValue to false in the onbeforecopy event handler for the same object as the oncopy event handler. On the other hand, to prevent user copying of body content, set event.returnValue to false for the oncopy event handler. Just don't regard this tactic as a foolproof way to prevent users from copying your prized content.

Typical Targets

Rendered elements except form controls.

Powered by Linode.