SimonPrice3376
asked on
Force Download of Zip file via JQuery
I am trying to create a download of a zip file using JQuery, however everything I try just opens the zip file rather than offer it as a download in IE11.
I have to work with IE11 as that's the corporate standard.
this is the code im working with right now.
I have tried this both ways too
any ideas on how to resolve this are most welcome
I have to work with IE11 as that's the corporate standard.
this is the code im working with right now.
$.ajax({
type: "POST",
url: "SubmissionTracker.aspx/ExportFile",
data: JSON.stringify(params),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
$("#hiddenLink").attr("href", data.d);
console.log($("#hiddenLink").val());
$("#hiddenLink")[0].click();
$("." + excel).show();
$("." + loader).hide();
},
error: function (data) {
console.log("error :" + data);
console.log(data);
$("." + excel).show();
$("." + loader).hide();
}
});
I have tried this both ways too
<a id="hiddenLink" href="" download="Export.zip"></a>
and <a id="hiddenLink" href=""></a>
any ideas on how to resolve this are most welcome
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
There is a working sample hereThe code will only work on IE - it uses the msSaveBlob call