我有以下代码将 Canvas 上的内容保存到文件中,但是当它保存时,它保存为 download
作为文件名。我该怎么做才能使用自定义文件名而不是下载
?
// Get the Canvas
var ctx = document.getElementById("myChart").getContext("2d");
// Handle Saving the Canvas
$(document).on("click", "#save-graph", function(e){
e.preventDefault();
var image = ctx.canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
window.location.href = image;
});
最佳答案
关于javascript - 使用自定义文件名保存 Canvas ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24806167/