I'd like to add some image to clipboard from my web browser(Chrome, Safari) on iPhone. For example:
- I have canvas element with some picture.
- I get from the
canvas
elementBlob
type of data - Create "ClipboardItem" with correct type and data
- Add to
ClipboardItem
toclipboard
usingwrite
- And on the MacBook, Windows laptops, Android devices, in chrome all correct work, but on iPhones nope ((
Help me please, my code example here 👇🏻
canvasEl.toBlob((blob) => {
if (!blob) return;
navigator.clipboard.write([
new ClipboardItem({
"image/png": new Promise(async (resolve) => {
resolve(new Blob([blob!], { type: "image/png" }));
}),
}),
]);
});