document.readyState =="完成"始终为false。的状态总是与QUOT;互动" [英] document.readyState == "complete" is always false. The state is always "interactive"

查看:237
本文介绍了document.readyState =="完成"始终为false。的状态总是与QUOT;互动"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我接线启动脚本JavaScript函数上的Page_Load火,像这样:

I am wiring a startup script JavaScript function on Page_Load to fire like so:

ScriptManager.RegisterStartupScript(Me, GetType(Page), "page_init", "page_init();", True)

该函数调用了几个不同功能的设置页面。其中的一个功能检查 document.readyState ,并确保它的完整的。这种处理影像,我想确保一切都已经完全呈现。

This function calls a couple of different functions to setup the page. One of those functions checks the document.readyState and makes sure it's "complete". This deals with images and I want to make sure everything has been fully rendered.

if (document.readyState == "complete") {

一切工作正常,直到我需要写一个字节数组的OutputStream(使用 Response.BinaryWrite Response.OutputStream.Write( )来给一个文件给用户。在此之后, document.readyState 始终是互动,直到我浏览过的网页和回到我甚至使用了的setTimeout(myFunction的,1000); 呼叫如果 document.readyState 不完整的,以递归调用函数,直到它完成。它从来没有达到完成。

Everything works fine, until I need to write a byte array to the outputstream (using either Response.BinaryWrite or Response.OutputStream.Write() to give a file to a user. After that, the document.readyState is always "interactive", until I navigate off of the page and back. I have even used a setTimeout(myFunction, 1000); call if document.readyState isn't complete to recursively call the function until it is complete. It never reaches "complete".

我已经研究这个自己相当一段时间,并不能弄清楚这种行为。任何想法,这是怎么回事?

I have researched this myself for quite sometime, and cannot figure out this behavior. Any ideas as to how this is happening?

推荐答案

我刚刚发现这个问题是一个IFrame,我道歉是一个细节留出了问题。

I just found out the issue is with an IFrame, which I apologize was a detail left out of the question.

更多信息,可以发现<一href="http://www.atalasoft.com/cs/blogs/jake/archive/2009/06/18/events-to-expect-when-dynamically-loading-iframes-in-javascript.aspx">here:

IE(令人惊讶的得到我的选票   审批这里)有一个   onreadystatechange事件将触发   每当iframe的readyState的   属性更改。这readyState的   反映其中下载的是在   流程。

IE (surprisingly gets my vote of approval here) There is an onreadystatechange event that fires whenever the iFrame's readyState property changes. That readyState reflects where the download is in the process.

内联:当您最初设置的SRC   IFRAME元素的值时,   readyState的改变装载。什么时候   该文件完全下载,   readyState的改变互动。   IE和之间的最大区别   其他的浏览器是IE,然后更改   readyState属性来完成   当页面(或应用程序)是   满载并为用户准备。

Inline: When you initially set the src value of the iFrame element, the readyState changes to loading. When the file has completely downloaded, the readyState changes to interactive. The big difference between IE and the other browsers is that IE then changes the readyState property to complete when the page (or application) is fully loaded and ready for the user.

附件:此行为相同   内联的情况下,IE浏览器中,但是   readyState属性不会改变,以   完成了。这不会太大   感,由于用户必须手动   通过双击它打开该文件   或者从某些应用程序中打开它。

Attachment: This behaves identically to the Inline case of IE, but the readyState property never changes to complete. That wouldn't make much sense, since the user has to manually open the file by double-clicking on it or opening it from some application.

这篇关于document.readyState ==&QUOT;完成&QUOT;始终为false。的状态总是与QUOT;互动&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆