开发者

Detecting when there is a response on an iframe?

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();


Handle the <iframe>'s onload and readystatechanged events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜