I have created an AJAX style file download (using an iframe) and all works well... however, I need to detect when the iframe has received a response... see below:
Javascript:
function download() {
var ifrm = $('#iframedownload')[0];
ifrm.src = '/downloadfile.aspx?fileid=whatever';
ifrm.onreadystatechange = function () { // Checking
if (this.readyState == 'complete')
alert("I would really like this piece to work!");
};
}
C# for downloadfile.aspx:
Response.AddHeader("content-disposition", "attachment; filename=\"" + zipFileName + "\"");
Response.AddHeader("Content-Length", respBytes.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(respBytes);
Response.End();
Thanks.