I solved my problem by removing the single quotes appearing at the beginning and end of the dataURL
function onSavePNG(url){
var save = document.createElement('a');
console.log(url[0]+' '+url[url.length-1]);
url = url.slice(1);
url = url.substring(0,url.length-1);
console.log(url[0]+' '+url[url.length-1]);
save.href = url;
save.target = '_blank';
save.download = 'Image.png' || 'unknown';
var event = document.createEvent('Event');
event.initEvent('click', true, true);
save.dispatchEvent(event);
(window.URL || window.webkitURL).revokeObjectURL(save.href);
}
It's working now :)