docs.rodeo

MDN Web Docs mirror

Window: copy event

{{APIRef}} 

The copy event fires when the user initiates a copy action through the browser’s user interface.

The original target for this event is the {{domxref("Element")}}  that was the intended target of the copy action. You can listen for this event on the {{domxref("Window")}}  interface to handle it in the capture or bubbling phases. For full details on this event please see the page on the Element: copy event.

Syntax

Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}} , or set an event handler property.

addEventListener("copy", (event) => { })

oncopy = (event) => { }

Event type

A {{domxref("ClipboardEvent")}} . Inherits from {{domxref("Event")}} .

{{InheritanceDiagram("ClipboardEvent")}} 

Examples

window.addEventListener("copy", (event) => {
  console.log("copy action initiated");
});

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN