0

I have single html page on this page I am just trying to download the canvas but getting this

enter image description here, I have also tried this but no luck ,also I cannot set CORS policy because there no web framework behind

$("#download" ).click(function() {
console.log( "Handler for .click() called." );

var link = document.createElement('a');
link.download = 'image.bmp';
link.href = document.getElementById('myCanvas').toDataURL();
link.click();

});
TAHA SULTAN TEMURI
  • 4,031
  • 2
  • 40
  • 66

1 Answers1

0

I think this is because you are loading this on the file protocol.

Try running it on an http-server, if you haven't got anything set-up, give the npm http-server package a try. Shouldn't take you more than 5 mins to set it up.

just install it globally and then run your folder.

Hope this helps!

Gijs Beijer
  • 560
  • 5
  • 19