views:

18

answers:

1

After an AJAX request to download a fragment of html, xmlhttp.readyState goes to 4 when the download is complete. It looks like readyState == 4 says nothing (and should say nothing, imo) about the browser's progress in rendering the downloaded matter.

So if my JS depends only upon readyState == 4 before starting to use the downloaded html, I stand a good chance of getting 'whatever_var is undefined' when the JS begins to execute. I don't want that.

How can I find out for sure when the browser is all done rendering?

I'm not using jquery or any other framework.

Test case that shows the problem: http://www.sellmycalls.com/cgi-bin/chain and then when the short page appears, press either of the green buttons in the menu box on the left (labeled "all options" and "watchlist"). Repeat a couple of times and the problem appears. If it looks like the page is hung up, close its tab and bring it up in a new tab.

Use Firebug/FF to see the error on the page; I don't claim in runs in any other browser.

The first time you load this page, you might see some intro material. Dismiss the intro box with the "hide intro"/"hide help" uncolored button in that menu box on the left. The error message on the console will be something like "cx_usrname is undefined". (There's also another error that shows up on this page: "unhandled exception ..." That's a different problem that I'm not worried about yet.)

Thanks!

A: 

Set up a function that runs after all of your intensive stuff that starts your interaction with the site. IE, hide the "start" button when the app first runs, then enable it with a function call after all your other code has run.

C Bauer
Thanks for the response, but I'm looking for a way to know when to run "all the other code".
Pete Wilson