Skip to Content
Platform.Ontology

Copy and cut events (rewrite what gets copied)

Lets a page change what the person's copy or cut puts on the clipboard.

Does something on your deviceTyping and clipboardClipboardWeb browsersWhile you use it

In one line

Can change what ends up on your clipboard when you copy from its page

Lets a page change what the person's copy or cut puts on the clipboard.

When the person presses copy, the site can append a credit line, strip formatting, or substitute other text. It cannot see other apps' copies; it only controls copies made inside its own page.

What it can and can't do

What the user does: You press copy or cut on text inside the page

It can

  • Add a credit line or link to the text you copy
  • Remove formatting from what you copy
  • Swap in different text than what you selected

It cannot

  • See what you copy in other apps or other tabs
  • Change your clipboard when you copy elsewhere
  • Act when you did not press copy or cut

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported12008-12-11None
EdgeSupported122015-07-29None
FirefoxSupported222013-06-25None
SafariSupported32007-10-26None
Safari on iPhoneSupported32009-06-17All iOS browsers use WebKit
Chrome on AndroidSupported182012-06-27None
Samsung InternetSupported1.02013-04-27None

How a site asks for it

APIdocument.addEventListener('copy', e => { e.clipboardData.setData('text/plain', x); e.preventDefault(); })
Browser compat keysapi.Element.copy_event
api.ClipboardEvent
api.DataTransfer.setData
How access is grantednone
What the user seesNone (no browser prompt)
Needs a secure context (HTTPS)No
Needs a user gestureNo
Activationnone
How long it lastsPer copy action
How to take it backNothing to revoke (no permission is stored)
Inside an iframeApplies per document; frames cannot hook the parent's copy

Typical flow

  1. Person selects text and presses copy or cut
  2. copy event fires with a writable clipboardData
  3. Page calls setData and preventDefault

Data you get

Shape: none

No individual data fields. The signal is the access itself.

Technical limits

  • Fires only for user initiated copy or cut inside the page (and programmatic execCommand copies)
  • No prompt and no gesture requirement beyond the person's own copy action
  • Cannot read the clipboard from the event (clipboardData is write only during copy)
  • Cannot fire for text copied in other tabs, apps or the address bar
  • Site sees that a copy happened and which selection, so it can log copy behavior

The story

What it is

A page can change what gets copied when you press Copy or Cut.

For you

You press copy on an article and then paste it into a message. You may find an extra line like 'Read more at ...' tacked on. Or the text pastes clean with no odd formatting. You usually never see it happen.

For makers

Makers use it to add credit lines and share links when text is copied, clean up formatting, or block copying of paid content. It is also used by rich editors to copy blocks of their own content in a special format.

Where you see it

TypeExampleApps
mediaA news site adds the article link and name after text a reader copies, so quotes pasted into chats point back to the source.None named
creativeA design web app puts a copied layer on the clipboard in its own format, so pasting inside the app keeps the design.Figma, Miro
productivityA spreadsheet in the browser copies a range of cells so it pastes as a clean table in another app.Google Sheets
educationAn online exam or course page tries to block copy so test questions are harder to leak.None named
developerA docs site copies a code snippet without the line numbers and prompt symbols.MDN
securityA scam page can swap the copied text for a different address, such as a payment account.None named

Risks

  • Can alter what you copy
  • Used to block copying

Good uses and abuse

Legitimate uses

  • Attribution on copy
  • Copy as plain text
  • Spreadsheet copy formats

Known abuse

  • Pastejacking and clipboard manipulation
  • Tracking what text people copy

Scores

ScoreValueMeaning
Sensitivity2 of 5How revealing the data is
Utility3 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bitsNot ratedRough identifying entropy, when known

History

  • 2012, Chrome 1: copy and cut events with clipboardData

Sources

How well checked: Based on official documentation.

On this page