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)
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") {
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?