I have the following code to save what is on the canvas to a file, but when it saves it saves as download
as the file name. What can I do to use a custom filename instead of 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;
});