Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1037776 of copy

  • Revision slug: Web/Events/copy
  • Revision title: copy
  • Revision id: 1037776
  • Created:
  • Creator: Nickolay
  • Is current revision? No
  • Comment Update the spec link, fix information about the event's trigger, target, and the default action; add the "Clipboard API" tag
Tags: 

Revision Content

The copy event is fired when the user initiates a copy action through the browser UI (for example, using the CTRL/Cmd+C keyboard shortcut or selecting the "Copy" from the menu) and in response to an allowed {{domxref("Document.execCommand", "document.execCommand('copy')")}} call.

General info

Specification
Clipboard
Interface
{{domxref("ClipboardEvent")}}
Bubbles
Yes
Cancelable
Yes
Target
{{domxref("Element")}}: the focused element (for {{domxref("HTMLElement.contentEditable", "contentEditable")}} elements - the element containing the start of the selection), or the {{HTMLElement("body")}} element.
Default Action
Copies the selection to the clipboard

Properties

{{OpenEventProperties()}}{{CloseEventProperties()}}

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
clipboardData {{ CompatVersionUnknown() }} {{ CompatGeckoDesktop(22) }} {{ CompatNo() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatVersionUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
clipboardData {{ CompatUnknown() }} {{ CompatGeckoMobile(22) }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
  • Copy-related events: {{CopyRelatedEvents()}}

Revision Source

<p>The <code>copy</code> event is fired when the user initiates a copy action through the browser UI (for example, using the CTRL/Cmd+C keyboard shortcut or selecting the "Copy" from the menu) and in response to an allowed {{domxref("Document.execCommand", "document.execCommand('copy')")}} call.</p>

<h2 id="General_info">General info</h2>

<dl>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Specification</dt>
 <dd style="margin: 0 0 0 120px;"><a class="external" href="https://www.w3.org/TR/clipboard-apis/#the-copy-action">Clipboard</a></dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Interface</dt>
 <dd style="margin: 0 0 0 120px;">{{domxref("ClipboardEvent")}}</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Bubbles</dt>
 <dd style="margin: 0 0 0 120px;">Yes</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Cancelable</dt>
 <dd style="margin: 0 0 0 120px;">Yes</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Target</dt>
 <dd style="margin: 0 0 0 120px;">{{domxref("Element")}}: the focused element (for {{domxref("HTMLElement.contentEditable", "contentEditable")}}&nbsp;elements - the element containing the start of the selection), or the {{HTMLElement("body")}} element.</dd>
 <dt style="clear: left; float: left; text-align: right; width: 120px;">Default Action</dt>
 <dd style="margin: 0 0 0 120px;">Copies the selection to the clipboard</dd>
</dl>

<h2 id="Properties">Properties</h2>

<p>{{OpenEventProperties()}}{{CloseEventProperties()}}</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{ CompatibilityTable() }}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari (WebKit)</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
  <tr>
   <td><code>clipboardData</code></td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatGeckoDesktop(22) }}</td>
   <td>{{ CompatNo() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE&nbsp;Phone</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatVersionUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
  <tr>
   <td><code>clipboardData</code></td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatGeckoMobile(22) }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
   <td>{{ CompatUnknown() }}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="Related_events">Related events</h2>

<ul>
 <li>Copy-related events: {{CopyRelatedEvents()}}</li>
</ul>
Revert to this revision