How to copy image to clipboard in firefox

Viewed 502

On my page I want the user to have an option where he clicks the button and the image is saved in the clipboard. I am using this code for this:

navigator.clipboard.write([
    new ClipboardItem({
            'image/png': blob
    })
]);

According to this https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/write This doesn't work with firefox. But there is no good alternative.

I found this but it's not for webpage only for addons https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/clipboard/setImageData

Also I know that this used to be done with execComend() but according to this https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand it's deprecated.

So how can I achieve such a basic task of copying images to clipboard on firefox?

0 Answers
Related