Javascript 检测iframe上何时有响应?
我已经创建了一个AJAX风格的文件下载(使用iframe),所有的工作都很好。。。但是,我需要检测iframe何时收到响应。。。见下文: Javascript:Javascript 检测iframe上何时有响应?,javascript,asp.net,javascript-events,Javascript,Asp.net,Javascript Events,我已经创建了一个AJAX风格的文件下载(使用iframe),所有的工作都很好。。。但是,我需要检测iframe何时收到响应。。。见下文: Javascript: function download() { var ifrm = $('#iframedownload')[0]; ifrm.src = '/downloadfile.aspx?fileid=whatever'; ifrm.onreadystatechange = function () { // Checking
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#对于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();
谢谢。ifrm.contentDocument.onreadystatechange适用于IE,但不适用于FireFox。。。仅在容器页面首次呈现时有效…请阅读此页面:ifrm.contentDocument.onreadystatechange适用于IE,但不适用于FireFox。。。仅在容器页面首次呈现时有效…请阅读此页面: