I am working on a downloader script and need to load html, get required elements and act accordingly. My probelm is onload for an iFrame is executing too early, and the html is emtpy. As I understand it, this is the way onload is supposed to act and the usual solution is to put an onload statement on the target page, but I don't have any control over the target URL. So I also tried a setTimeout(parseHTL_function_here). But the same thing happens, empty html, it seems the setTimeout also prevents html loading in background. If I put an alert just inside the parseHTL_function and wait a few seconds before clicking ok , the script works, html intact.

So the basic question is: How can I wait until an iFrame's content is fully loaded before acting on it?

Any ideas would be greatly appreciated,
Todd