跳转到内容

异步剪贴板 API

异步剪贴板 APInavigator.clipboard 提供 read()/write()(以及仅处理文本的 readText()/writeText()),使页面能够以编程方式复制和粘贴,而不必依赖较旧的 document.execCommand('copy')。访问受到限制:大多数引擎要求调用发生在用户手势事件 处理程序内,或者已获得 clipboard-read/clipboard-write 权限。

Browser / PlatformSupportSinceConfidenceSourceNotes
Chrome (Desktop)✅ yes76highrefread() requires the clipboard-read permission. write() requires the clipboard-write permission or, from Chrome 107, a user gesture.
Edge (Desktop)✅ yes79highref
Firefox (Desktop)✅ yes127highrefwrite()/read() must be called within a user gesture event handler.
Safari (macOS)✅ yes13.1highref

Source: spec · MDN · Last verified 2026-07-21 · Confidence: high

← 返回兼容性浏览器。