I've created new download function using JS for IE9, but it doesn't work.
descargarArchivo : function (url, idlote) {
var str = window.location.href+"/"+url;
str = str.replace("form.do/", "");
// Le da nombre del fichero que se va a descargar
var filename = 'factura_'+idlote;
xhr= new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function() {
var a = document.createElement('a');
a.href = window.URL.createObjectURL(xhr.response);
a.download = filename; // Set the file name.
a.style.display = 'none';
document.body.appendChild(a);
a.click();
delete a;
}
}
};
xhr.open('GET', str);
xhr.send();
}
I read that, in IE9 there is no Blob type, so xhr.response
returns undefined. How can I resolve it?