Following my previous question here ,
I have a desktop application using the Electron and Javascript framework, where I convert an HTML5 canvas to JPEG using:
<a id="download" download="Path.jpg">Download JPG</a>
then
function download(){ var dt = canvas.toDataURL('image/jpeg'); this.href=dt; } document.getElementById('download').addEventListener('click', download, false);
This updates my entire application. How do I change this behavior so that the page does not refresh when I click on the download attribute?
source share