tags: #clipboard #js-copy #js-paste #copy #paste ## Copy and paste in Javascript See also CopyToClipbard. The [mozilla docs](https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API). Also [this stackoverflow question](https://stackoverflow.com/questions/6413036/get-current-clipboard-content). With async/await syntax: ```js const text = await navigator.clipboard.readText(); ``` Or with Promise syntax: ```js navigator.clipboard.readText() .then(text => { console.log('Pasted content: ', text); }) .catch(err => { console.error('Failed to read clipboard contents: ', err); }); ``` ## Paste images See [this stackoverflow question](https://stackoverflow.com/questions/38167022/upload-picture-to-server-from-clipboard)