You are using the new (html5) download attribute. As far as I know this is only supported in Chrome and not (yet) in Firefox.
Update 3-2018
This feature is now supported in almost all major browsers (No IE support).
Alternative: Using location.href
Another way to force a download is to redirect the user to the image like this:
// generate the image
var img = ""
// then call a function maybe onClick or something
downloadImage(img);
function downloadImage(data) {
location.href = "data:application/octet-stream;base64," + data;
}
Or the short version
location.href = "data:application/octet-stream;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAOCAYAAAAmL5yKAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAABWSURBVDhPY0xISPh//0UOA7mAiVyNMH2jBjAwkBQGjD9KGBTEJ6OEO0kG2NvbMwCjnXwDsEU5SS5ANuDhjRCGJbPFSQsDdBfIyMhQZgDIQLK9QLWkDABPsQw5I+5qmAAAAABJRU5ErkJggg=="
Alternative: Server Side
As an alternative, if you are processing the image serverside you can force a download by setting the content-disposition header.
PHP Example
header('Content-Disposition: attachment; filename="image.png"');