I am using angularjs http post to download the file from the Web Api on the button click.My code works fine in Google Chrome and Firefox but it is not working in the Internet Explorer. Here's my code
$scope.CallApi = function () {
$http({
url: some url,
dataType: 'json',
method: 'POST',
data: null,
responseType: 'arraybuffer',
}).success(function (responsedata, status, xhr) {
var file = xhr('Content-Disposition');
console.log(file);
var filename = file.substr(21, 7);
$scope.value = responsedata;
var fileName = filename;
var blob = new Blob([responsedata], { type: "application/octet-stream" });
var url = URL.createObjectURL(blob);
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
a.href = url;
a.download = fileName;
}).error(function (error) {
alert("Error Found" + " : " + error);
});
};
The above code is not working in IE, I don't want to use FileSaver.js extension is there any other way to download the file from api in Internet Explorer. Below I have attached the Screen Shot of the error that I am getting in the Internet Explorer....
Thank You in Advance.....