代码有问题

时间:2014-10-19 06:13:57

标签: javascript download

var image = new Image();
image.src = canvas.toDataURL("image/png");
var link = document.createElement('a');
link.href = image;
link.download = 'Download.png';
document.body.appendChild(link);
link.click();

当我使用此脚本时,它会返回一个下载错误

(File not found)

为什么?

1 个答案:

答案 0 :(得分:3)

更改

link.href = image;

link.href = image.src;