Solved

Notify parent when Iframe is done loading

Posted on 1998-09-08
11
2,033 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 200 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error viewing ASP page 12 164
Show banners that are blocked by Ad Muncher 10 56
specific questions about shipping a coat 4 43
Query still returning duplicates 5 29
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
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…

772 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