How to trigger a download from DataURL in IE

1.3k views Asked by At

I'm retrieving a file as a base64 string from the server and needs to implement download functionality in JavaScript. How can I achieve this.

I used download attribute on anchor tag but this doesn't support in IE.

window.open also doesn't support in IE because what I have is a data url

1

There are 1 answers

0
Arjen On BEST ANSWER

Post it to the server and set the appropriate headers. There is afaik no other solution that will work in more browsers

header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"png.png\");