Determining if a web page is done loading


So i’m trying to figure out a good way to determine whether a web page is done loading or not so that I know that it’s time to move on to the rest of my script. In IE7 and IE8 what i’ve come up with is looking for the word “Done” at the bottom of the window. I don’t really like this because it’s not really reliable (sometimes Done will appear before it’s actually done loading) and to top it off in IE9 and IE10 that doesn’t work at all.

So is there a simple command or something that i’m missing that I can use to determine if a webpage is done loading? This seems like a simple enough idea that I was sure that it would be asked about somewhere else on the forums but I couldn’t find anything. Perhaps everyone else just knows something I don’t? :P.

Thank you in advance!

A technique that is usually reliable is to watch for the reload button/icon to appear. For most browsers, the reload button becomes a cancel button while the page is loading. In the case of some sites that use Flash or Java applets or the like, the page components may fully load (i.e., the communication with the server ends) before those components generate the display, and in that case even the reload technique may fail. If you know that you are working with a site of this kind, the best option is usually to wait for several known elements of the page to appear, or just wait a fixed amount of time, the latter option being a last resort.