I use this code to download excel file from server.
$.ajax({ headers: CLIENT.authorize(), url: '/server/url', type: 'POST', contentType: "application/json; charset=utf-8", data: JSON.stringify(jsonData), success: function (data) { alert('Data size: ' + data.length); var blob = new Blob([data], { type: "application/vnd.ms-excel" }); alert('BLOB SIZE: ' + data.length); var URL = window.URL || window.webkitURL; var downloadUrl = URL.createObjectURL(blob); document.location = downloadUrl; }, }); The problem I experience is that even though data and blob sizes are identical, the moment document.location gets assigned I'm prompted to download almoste two times larger excel file. And when I try to open it, excel complains about wrong file format and opened file contains a lot of garbage, even though required text is still there.
Any ideas what is causing this and how to avoid it?
arrayBuffer