This proposes to expose read-only files on the clipboard to renderers using a similar approach to drag-and drop. Renderers will have access to read files from the clipboard, but not write files to the clipboard. For files on the clipboard, renderers will have read-only access. async function onPaste(e) { let file = e.clipboardData.files[0]; let contents = await file.text(); }

Motivation

Chrome supports files via DataTransfer for drag and drop, but not for clipboard. It is useful for users to be able to use clipboard keyboard shortcuts such as Ctrl+C, Ctrl+V for a task such as attaching a file to an email rather than only drag and drop.

Specification

Editor's draft

Status in Chromium

Blink>DataTransfer


Enabled by default (tracking bug) in:

  • Chrome for desktop release 91

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owner

Last updated on 2021-07-17