Solved

Notify parent when Iframe is done loading

Posted on 1998-09-08
11
1,995 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This video teaches users how to migrate an existing Wordpress website to a new domain.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now