Hacker News new | ask | show | jobs
by peanut_worm 1667 days ago
You can’t download the image on iOS
1 comments

This unfortunately, is a known issue. I tried adding a download button, but that also only worked on desktop. Probably some browser policy thing. The same is true for Android (Chrome and Firefox Nightly).
You can convert the canvas to a Blob with HTMLCanvasElement.toBlob(), then create a blob URL from that with URL.createObjectURL(). You can then replace the canvas with an <img src="blob://...">, which can be long press saved; add a download button linking to that blob URL; or whatever. Works on all non-ancient mobile browsers I've tested.

Do note that Firefox’s privacy.resistFingerprinting can block you from reading canvas image data, giving you garbage instead, and the permission prompt is basically unnoticeable if the user isn’t actively looking for it.

Thank you. I tried to implement this, but I got empty/missing images on mobile browsers. It basically worked everywhere where right-clicking also worked. I'll look into it more when I have more time.
I was able to download the image on iOS just now, using Firefox on iOS.
It showed up in my camera roll immediately, which seemed to ruin the joke until I read the explanation.