I am trying to download an octet stream (basically JavaScript string) as CSV in my app using the following code:
//first getting the csv string from service
var csv = csvService.csv;
var hiddenElement = document.createElement('a');
hiddenElement.href = $window.URL.createObjectURL(new Blob([csv], {
type: "attachment/csv"
}));;
hiddenElement.target = '_blank';
hiddenElement.download = 'myFile.csv';
hiddenElement.click();
This is working fine in Chrome and Firefox, but not in Internet Explorer (tried with 11). The file just doesn't get downloaded. What's the way to make it (or some other method) work in IE to download file? Really stuck with this.