I'm trying to save canvas as image.
Everything works fine, but I get a warning message in the browser: "Resource interpreted as Document but transferred with MIME type image/octet-stream ..."
I use the following code:
let img = canvas
.toDataURL("image/png")
.replace("image/png", "image/octet-stream");
window.location.href = img;
Is it possible to make the browser not give this warning?
Chrome doesn't recognize image/octet-stream
. The MIME type for arbitrary binary data is application/octet-stream
.
But you don't have arbitrary binary data, you have a PNG in a data URL. There are more user-friendly ways to download that.