Closed Bug 35253 Opened 25 years ago Closed 24 years ago

ONLOAD handler of (I)FRAME whose content is document.written not firing

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

VERIFIED DUPLICATE of bug 57636
mozilla0.8

People

(Reporter: martin.honnen, Assigned: jst)

Details

Attachments

(2 files)

In the example below I start with a blank IFRAME (SRC="about:blank") and then 
document.write content with a BODY ONLOAD handler to it. That handler fires the 
first time content is written (from the containing page's onload handler) but 
doesn't fire when on button press the iframe's content is replaced.

<HTML>
<HEAD>

<SCRIPT>
var i = 1;
function writeToIframe() {
  var ifrWin = window.frames['anIframe'];
  html = '';
  html += '<HTML>';
  html += '<BODY';
  html += ' ONLOAD="alert(event.type);"';
  html += '>';
  html += 'Kibology' + i++;
  html += '<\/BODY>';
  html += '<\/HTML>';
  ifrWin.document.open();
  ifrWin.document.write(html);
  ifrWin.document.close();
}
</SCRIPT>
</HEAD>
<BODY ONLOAD="writeToIframe();">
<BUTTON ONCLICK="writeToIframe()">
write to iframe
</BUTTON>
<BR>
<IFRAME NAME="anIframe" SRC="about:blank"></IFRAME>
</BODY>
</HTML>
QA Contact: gerardok → janc
Status: NEW → ASSIGNED
Target Milestone: --- → M18
This bug has been marked "future" because the original netscape engineer
working on this is over-burdened. If you feel this is an error, that you or
another known resource will be working on this bug,or if it blocks your work
in some way -- please attach your concern to the bug for reconsideration.
OS: Windows 98 → All
Hardware: PC → All
Target Milestone: M18 → Future
I have created another test case for a normal frame which exhibits the same bug, 
i.e. the content is document.written but the onload handler doesn't fire.
I am rather concerned that you handle such things as future stuff (which as I 
understand means it doesn't even make it into the first commercial release). 
Document.writing to a frame and using the onload handler is basic stuff a client 
side JavaScript scripter is used to since NN3 and relies on without wanting to 
make exceptions of what is supposed to be the future of browsing.
Summary: ONLOAD handler of IFRAME whose content is document.written not firing → ONLOAD handler of (I)FRAME whose content is document.written not firing
Related to this, and hopefully adding some gravity to the situation, is that an
IFRAME does not generate a load event for externally loaded content either (in
M17). This is important if you want to load some HTML into a hidden IFRAME and
do something with it after it loads--gotta be triggered by onLoad, since you
can't setTimeout() subsequent action reliably.

Here's a simple test case:

<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript>
function loadIt() {
	document.getElementById("myIFRAME").src = "http://www.mozilla.org"
}
</SCRIPT>
</HEAD>
<BODY>
<H1>IFRAME onLoad event handler test</H1>
<HR>
<FORM>
<INPUT TYPE="button" VALUE="Load into IFRAME" onClick="loadIt()">
</FORM>
<IFRAME ID="myIFRAME" onLoad="alert('IFRAME has loaded.')"></IFRAME>
</BODY>
</HTML>
There is a separate bug with test case for simple frames:
http://bugzilla.mozilla.org/show_bug.cgi?id=57636.
Can't believe that such basic functionality that works in all version 3 browsers
including IE3 gets dropped. What a mess!!
Welcome to the past!
XML? Separate data in web pages? You must be kidding. No way without onload events.
proposing target version of mozilla0.8 (it's significant for one of my 
customers) and adding nisheeth@netscape.com, joec@netscape.com to cc list
Keywords: mozilla0.8
Aiming for mozilla0.8 and nominating for nsbeta1.
Keywords: nsbeta1
Target Milestone: Future → mozilla0.8
Turns out this is a duplicate of 57636.

*** This bug has been marked as a duplicate of 57636 ***
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Keywords: mozilla0.8
QA contact Update
QA Contact: janc → desale
VERIFIED dup
Status: RESOLVED → VERIFIED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: