Closed Bug 90533 Opened 23 years ago Closed 23 years ago

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

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: rossb, Assigned: joki)

References

()

Details

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
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?
i'm seeing the problem on NS6, so it could be fixed in recent builds. if so, i'm happy. :)ross
Both onloads fire for me Platform: PC OS: Linux 2.2.16 Mozilla Build: 2001073021 Marking WORKSFORME>
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
verifed on build 2001-08-15-trunk
Status: RESOLVED → VERIFIED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.