I'm just trying to work this code in Internet Explorer. In Chrome and Firefox is ok, but on Internet Explorer is showing the message "Do you want to allow this website to open an app on your computer".
The Challenge is to download a PDF from a String Base64.
Then
JSFIDDLE: https://jsfiddle.net/7prjvcun/
The code:
<html>
<head>
<title>Index</title>
</head>
<body id="index" >
<a target="_blank" id='dwnldLnk' download='nome-do-arquivo.pdf' href="javascript:void(0);">LINK </a>
<script type="text/javascript">
var pdf = 'data:application/octet-stream;base64,' +
'JVBERi0xLjUNCiW1tbW1DQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIvTGFu' +
...
'OTM4MjIvWFJlZlN0bSA5MzU2NT4+DQpzdGFydHhyZWYNCjk0MjU5DQolJUVPRg==';
var dlnk = document.getElementById('dwnldLnk');
dlnk.href = pdf;
dlnk.click();
</script>
</body>
</html>
People, I discover in http://caniuse.com/#search=anchor , IE not suport the atributte download.
Now I will looking for a another way.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.