onload event doesn't fire for document created with document.write

VERIFIED WORKSFORME

Status

()

VERIFIED WORKSFORME
18 years ago
18 years ago

People

(Reporter: rossb, Assigned: joki)

Tracking

Trunk
x86
Windows 2000
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

18 years ago
The following html fills an IFRAME using document.write
i would expect the onload event to fire, but it doesn't.

<html>
<head>
<script>
function fill_iframe()
{
var w = window.frames["foo"];
w.document.open();
w.document.write("<html><body onload='alert(\"Repro1!
\");'>Repro1</body></html>");
w.document.close();
}
</script>
</head>
<body onload="fill_iframe();">
<iframe name="foo" src=""></iframe>
</body>
</html>

If you put the text:
<html>
<body onload='alert("Repro2!");'>
Repro2
</body>
</html>

into a separate file and point the src of the iframe at it, the onload fires 
(in fact you can then change back to src="" and reload the html and it still 
fires.  if you close the browser and open a new one with src="" the onload 
event does NOT fire.)

Note that i had to use a http server to repro as i could not get 
src="repro2.html" to work at all on the filesystem (separate bug).

The above URL shows two iframes, one that does document.write, one that loads a 
static html file.  only one alert shows up.

:)ross

Comment 1

18 years ago
Testing out your url http://nsrepro.westside.com/onloadRepro.html in 

Linux build 2001073008 and
Windows NT4.0 build 2001073017

I get both alerts being triggered.  Has the problem been resolved?
(Reporter)

Comment 2

18 years ago
i'm seeing the problem on NS6, so it could be fixed in recent builds.  if so, 
i'm happy.

:)ross

Comment 3

18 years ago
Both onloads fire for me

Platform: PC
OS: Linux 2.2.16
Mozilla Build: 2001073021

Marking WORKSFORME>
Status: UNCONFIRMED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → WORKSFORME

Comment 4

18 years ago
verifed on build 2001-08-15-trunk
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.