Window: copy event

当用户通过浏览器的用户界面启动复制操作时,将触发 copy 事件。

Bubbles(支持冒泡) Yes
Cancelable(可撤销) Yes
Interface(接口) ClipboardEvent
Event handler property(事件处理程序属性) oncopy

此事件的原始目标是 Element 它是复制操作的预期目标。您可以在 Window 界面上监听此事件,以在捕获或冒泡阶段对其进行处理。 有关此事件的完整详细信息,请参见 Element: copy event.

示例

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

规范

规范 状态
Clipboard API and events Working Draft

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
copy eventChrome Full support 58Edge Full support ≤18Firefox Full support YesIE No support NoOpera Full support 45Safari Full support YesWebView Android Full support 58Chrome Android Full support 58Firefox Android Full support YesOpera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0
clipboardDataChrome Full support 58Edge Full support ≤18Firefox Full support 22IE No support NoOpera Full support 45Safari Full support YesWebView Android Full support 58Chrome Android Full support 58Firefox Android Full support 22Opera Android Full support 43Safari iOS ? Samsung Internet Android Full support 7.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

参考