In JavaScript, the copy event fires when the user starts a copy action through the browser UI (MDN). The default action copies the current selection (if any) to the clipboard.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for copy. Start with this line.
JavaScript
addEventListener("copy", fn)
Call
What it does
addEventListener("copy", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("copy", …) — no import required.
Library declarations
JavaScript
addEventListener("copy", fn)
Parameters
Parameter
Description
Event name
Required. "copy"
Handler prop
Optional. oncopy
Return Value
Return Value
Description
*
Fires as an Element event (listener receives the Event object).
JavaScript Examples
Example 1 — Copy Selection as Uppercase (MDN)
Rewrite clipboard text with setData + preventDefault.
Target one element. Only that control’s copy default is canceled.
Call preventDefault(). Stops the browser from placing the selection on the clipboard.
Not a security guarantee. Users can still screenshot or view source — treat as UX, not DRM.
Prefer clear UI if copy is intentionally disabled (accessibility).
Compatibility
Browser Support
Elementcopy is Baseline Widely available (MDN: since July 2015). Safe to use in modern and older evergreen browsers.
✓ Baseline · Widely available
copy
Fires when the user initiates a copy action through the browser UI.
99%Widely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
copyExcellent
Bottom line: Use copy to observe or customize the user’s copy gesture. Write with clipboardData.setData + preventDefault; do not expect to read the clipboard in this handler.
Frequently Asked Questions
It fires when the user starts a copy action through the browser UI (for example Ctrl+C / Cmd+C or Edit → Copy). The default action copies the current selection to the clipboard (MDN).
No. MDN marks Element copy as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A ClipboardEvent. The important property is clipboardData, which you can write to with setData(format, data).
No. MDN: a copy handler cannot read clipboard data. You can write with setData after cancelling the default action, but reading is restricted.
Call event.clipboardData.setData("text/plain", yourText) and event.preventDefault() so the browser does not copy the raw selection instead.
No. You can dispatch a synthetic copy event, but that alone will not put data on the system clipboard (MDN).