Copy and cut events (rewrite what gets copied)
Lets a page change what the person's copy or cut puts on the clipboard.
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
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 1 | 2008-12-11 | None |
| Edge | Supported | 12 | 2015-07-29 | None |
| Firefox | Supported | 22 | 2013-06-25 | None |
| Safari | Supported | 3 | 2007-10-26 | None |
| Safari on iPhone | Supported | 3 | 2009-06-17 | All iOS browsers use WebKit |
| Chrome on Android | Supported | 18 | 2012-06-27 | None |
| Samsung Internet | Supported | 1.0 | 2013-04-27 | None |
How a site asks for it
| API | document.addEventListener('copy', e => { e.clipboardData.setData('text/plain', x); e.preventDefault(); }) |
| Browser compat keys | api.Element.copy_eventapi.ClipboardEventapi.DataTransfer.setData |
| How access is granted | none |
| What the user sees | None (no browser prompt) |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| Activation | none |
| How long it lasts | Per copy action |
| How to take it back | Nothing to revoke (no permission is stored) |
| Inside an iframe | Applies per document; frames cannot hook the parent's copy |
Typical flow
- Person selects text and presses copy or cut
- copy event fires with a writable clipboardData
- 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
| Type | Example | Apps |
|---|---|---|
| media | A 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 |
| creative | A design web app puts a copied layer on the clipboard in its own format, so pasting inside the app keeps the design. | Figma, Miro |
| productivity | A spreadsheet in the browser copies a range of cells so it pastes as a clean table in another app. | Google Sheets |
| education | An online exam or course page tries to block copy so test questions are harder to leak. | None named |
| developer | A docs site copies a code snippet without the line numbers and prompt symbols. | MDN |
| security | A 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
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2012, Chrome 1: copy and cut events with clipboardData
Related capabilities
Related
- Async Clipboard write. Can put text or images on your clipboard when you tap a button
- Paste event (read what the person pastes). Can get what you paste, but only when you press paste on its page
Sources
How well checked: Based on official documentation.