I'd recommend using something like FileSaver.js to get the most cross browser solution.
For Chrome and Firefox you can use something like this:
var downloadLink = document.getElementById('my-anchor-tag');
downloadLink.href = dataURL;
downloadLink.setAttribute('download', 'file-name.png');
Note: you could set the download attribute statically in the HTML as well.
For IE you can use a vendor specific msSaveBlobAs() method. More info on that here: http://msdn.microsoft.com/en-us/library/ie/hh779016(v=vs.85).aspx
Again one of the best cross browser solutions is FileSaver.js found here: https://github.com/eligrey/FileSaver.js/