I have single html page on this page I am just trying to download the canvas but getting this
, 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();
});
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!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.