Mira060397
asked on
Notify parent when Iframe is done loading
How can a document containing an Iframe be notified when the Iframe is done loading its web page?
Example: Parent Document
<html>
<head>
<title>Parent Document</title>
</head>
<body>
<Iframe id="Child_Document" src="child_document.htm"> </iframe>
</body>
</html>
I want to notify the Parent Document that the iframe is done loading "child_document.htm" without adding any code (script/HTML) to the "child_document.htm" document.
I can only add code to the Parent Document.
Basically the "child_document.htm" can be any htm file, so I can't add custom code to the "child_document.htm".
Any Ideas?
Example: Parent Document
<html>
<head>
<title>Parent Document</title>
</head>
<body>
<Iframe id="Child_Document" src="child_document.htm"> </iframe>
</body>
</html>
I want to notify the Parent Document that the iframe is done loading "child_document.htm" without adding any code (script/HTML) to the "child_document.htm" document.
I can only add code to the Parent Document.
Basically the "child_document.htm" can be any htm file, so I can't add custom code to the "child_document.htm".
Any Ideas?
I also had this problem, and the only way I know of fixing it was to put a <SCRIPT FOR=document EVENT=onload>
parent.processIframe();
</SCRIPT>
In the child document. IE has no way of determining when a web page as finished loading.
If it is data coming from the child document maybe you should consider using XML, or data binding.
parent.processIframe();
</SCRIPT>
In the child document. IE has no way of determining when a web page as finished loading.
If it is data coming from the child document maybe you should consider using XML, or data binding.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
egerci,
What you have posted is a way to detect when a FRAME finishes loading. However this question is about detecting when an IFRAME has finished loading. Unfortunately the same method cannot be applied.
Trevor.
What you have posted is a way to detect when a FRAME finishes loading. However this question is about detecting when an IFRAME has finished loading. Unfortunately the same method cannot be applied.
Trevor.
ASKER
Trevor is right.
Is there any other way besides putting code in the child document?
Is there any other way besides putting code in the child document?
Mira,
You should reject egerci's answer so that other experts can offer a solution.
I don't believe that there is a way to detect an IFRAME's loaded status without putting something in the child window.
Trevor.
You should reject egerci's answer so that other experts can offer a solution.
I don't believe that there is a way to detect an IFRAME's loaded status without putting something in the child window.
Trevor.
Ok what about this code? It also run :))
<HTML>
<HEAD>
<TITLE> </TITLE>
<META NAME="keywords" CONTENT="">
<META NAME="description" CONTENT="">
<META NAME="Author" CONTENT="H.Ali EGERCI(egerci@yahoo.com)">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-9">
</HEAD>
<body onLoad="alert('OK')" >
<Iframe id="Child_Document" src="child_document.htm"> </iframe>
</body>
</HTML>
<HTML>
<HEAD>
<TITLE> </TITLE>
<META NAME="keywords" CONTENT="">
<META NAME="description" CONTENT="">
<META NAME="Author" CONTENT="H.Ali EGERCI(egerci@yahoo.com)">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-9">
</HEAD>
<body onLoad="alert('OK')" >
<Iframe id="Child_Document" src="child_document.htm"> </iframe>
</body>
</HTML>
egerci,
Nice one. The IFRAME must therefore become part of the parent documents object and all parent document checks must be satisfied by both parent and child.
Why is it time and time again it is something so simple but it takes an Expert to spot it.
Trevor.
Nice one. The IFRAME must therefore become part of the parent documents object and all parent document checks must be satisfied by both parent and child.
Why is it time and time again it is something so simple but it takes an Expert to spot it.
Trevor.
ASKER
That could have worked, but my problem is a little more complex than that.
It's because the Child_Document source will change when a user clicks on a button on the Parent_document (for example). The Child source changes but the Parent source does not. Therefore the parent never triggers its OnLoad event again. Meaning The Parent doesn't know when the new document in the Child is done loading.
It's because the Child_Document source will change when a user clicks on a button on the Parent_document (for example). The Child source changes but the Parent source does not. Therefore the parent never triggers its OnLoad event again. Meaning The Parent doesn't know when the new document in the Child is done loading.
Mira,
Now that throws a different light on the matter. I don't think no matter what you do you will be able to achieve this without setting a flag from the child document.
Trevor.
Now that throws a different light on the matter. I don't think no matter what you do you will be able to achieve this without setting a flag from the child document.
Trevor.
ASKER
Under most circumstances your answer would have worked. But for my specific instance, there doesn't seem to be a solution with the current technology.
I am not aware of any way to do this. Putting an onLoad in the IFRAME code line doesn't work. I think that without editing the child code this will not be possible. I'll do some checking though just to make sure.
Trevor.