Skip to content

tvpsh2020-zz/clipboard-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clipboard API

Sample for Clipboard API and events in web applications (without asynchronous Clipboard API), you can try to paste image file from system's clipboard, either files or screenshot.

Codepen: https://codepen.io/tvpsh2020/pen/KZvpBE

Demo: https://morning-eyrie-32138.herokuapp.com/

When trying to paste image, it works on macOS with Chrome, but Windows with Chrome can only paste the screenshot in clipboard. Pasting text is fine on both macOS and Windows.

Reference

[1] Clipboard API and events (W3C latest published version) - https://www.w3.org/TR/clipboard-apis

[2] Unblocking Clipboard Access (Google) - https://developers.google.com/web/updates/2018/03/clipboardapi

[3] DataTransfer (MDN) - https://developer.mozilla.org/en-US/docs/Web/API/ClipboardEvent

[4] ClipboardEvent (MDN) - https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer