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?
Does the document loaded in the iframe belong to the same domain as the parent? If not, there is nothing you can do, as there is no way to establish a cross-domain javascript relationship, for obvious security reasons.
I don't have control over the document going into the iFrame, it's not my doc. Unless I can add it after it is loaded in the iFrame? Is that possible?
Todd
like kor said, if the doc is on another server, it's out of your reach.
if it is on your domain but you can't change it, ypu can use javascript to find the iframe's window, and add a load event to it or manipulate a loaded page directly.
Bookmarks