The following code works well for Google Chrome but not for IE11.
<!DOCTYPE html>
<html>
<head>
<title>title</title>
</head>
<body>
<img id="img1" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAASUlEQVRo3u3PAQ0AIAwDsIGC+TcL
LkhOWgddSU6Ga5udT4iIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIi8cQEjUgGT
mE6z3QAAAABJRU5ErkJggg==" />
<script>
var a = document.createElement('a');
var image = document.getElementById('img1');
a.setAttribute('href', image.src);
a.setAttribute("download", 'fileName');
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
</script>
</body>
</html>
When I run this code in IE11 I've got message: "Do you want to allow this website to open an app on your computer?"
After clicking "Allow" I've got "No apps are installed to open this type of link (data)"
How to make it work in IE11?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…