I am trying to export an HTML5 canvas as a PNG file so that it is stored on the user computer.
The following snippet saves the image correctly.
document.location.href = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
However, using Chrome on Mac OS X, it is always saved as a โdownloadโ. In Safari, this is called "Unknown." Firefox gives the name gobbledygook.
Can I suggest a browser to use a name like "exportedImage.png"?
source share