Seemingly, you can\'t (yet) programmatically copy an image to the clipboard from a JavaScript web app?
I have tried to copy a text in clipboard , and it\'s worked.<
So, i created the perfect solution with 1 liner-kinda solution to convert something with html2canvas to a canvas and then produce the image of it and then save it to clipboard as png. For example,
HTML:
<div id="copyToImage">Hello World!</div>
JavaScript:
$("#copyToImage").click(function() {
html2canvas(document.querySelector("#copyToImage")).then(canvas => canvas.toBlob(blob => navigator.clipboard.write([new ClipboardItem({'image/png': blob})])));
});