我创建了一个AJAX样式文件下载(使用iframe)并且一切正常...但是,我需要检测iframe何时收到响应...请参阅下文:
使用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();
感谢。