Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Notify parent when Iframe is done loading

Posted on 1998-09-08
11
Medium Priority
?
2,135 Views
Last Modified: 2013-12-25
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?
0
Comment
Question by:Mira060397
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1854855
Mira,

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.

0
 

Expert Comment

by:deans
ID: 1854856
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.

0
 

Accepted Solution

by:
egerci earned 600 total points
ID: 1854857
Bellow code runs properly both with netcape and IE
when the frames are loaded it appears an alert box. You can easily add any JavaScript function to onLoad Funtion
for example:
<FRAMESET  COLS="21%,*" onLoad="writeOk()">
and write writeOk funtion in JavaScript.
:))


<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>
<!-- frames -->
<FRAMESET  COLS="21%,*" onLoad="alert('OK')">
    <FRAME NAME="lft" SRC="sublft.html" FRAMEBORDER="yes" >
    <FRAME NAME="rgt" SRC="subrgt.html" FRAMEBORDER="yes" >
</FRAMESET>
</HTML>

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Trevor013097
ID: 1854858
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.


0
 

Author Comment

by:Mira060397
ID: 1854859
Trevor is right.

Is there any other way besides putting code in the child document?
0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1854860
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.
0
 

Expert Comment

by:egerci
ID: 1854861
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>

0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1854862
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.


0
 

Author Comment

by:Mira060397
ID: 1854863
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.
0
 
LVL 5

Expert Comment

by:Trevor013097
ID: 1854864
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.

0
 

Author Comment

by:Mira060397
ID: 1854865
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.


0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question