1

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?

alexfrize
  • 1,022
  • 1
  • 16
  • 35

1 Answers1

1

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.

Community
  • 1
  • 1
AuxTaco
  • 4,883
  • 1
  • 12
  • 27