471,055 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,055 software developers and data experts.

document.write to an IFRAME - odd effect

Let's say I've an IFRAME on a page, with an ID of "myFrame".
If I call -

myFrame.document.write( "Something" );

the "Something" gets written to the IFRAME, as expected, but
the browser (and this happens with all four major browsers)
continues to "load" the page. Even if there's nothing else left
to load.

Has anyone else noticed this? Is there a way around it?
Jul 23 '05 #1
2 8077
Gunther Radick wrote on 04 dec 2004 in comp.lang.javascript:
Let's say I've an IFRAME on a page, with an ID of "myFrame".
If I call -

myFrame.document.write( "Something" );

the "Something" gets written to the IFRAME, as expected, but
the browser (and this happens with all four major browsers)
continues to "load" the page. Even if there's nothing else left
to load.

Has anyone else noticed this? Is there a way around it?


How do you notice that "continue to load"?
Jul 23 '05 #2
Gunther Radick wrote:
Let's say I've an IFRAME on a page, with an ID of "myFrame".
If I call -

myFrame.document.write( "Something" );

the "Something" gets written to the IFRAME, as expected, but
the browser (and this happens with all four major browsers)
continues to "load" the page. Even if there's nothing else left
to load.

Has anyone else noticed this? Is there a way around it?


Assuming that myFrame is a valid reference to the IFrame and not an IE
shortcut to it:

myFrame.document.open();
myFrame.document.write();
myFrame.document.close();

When you are remotely writing to a document (from anywhere other than
the page), you close() the document to let the browser know you are
finished writing, otherwise the browser is waiting for more instruction
so the page "continues loading".

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by DJ WIce | last post: by
1 post views Thread by Jesse Liberty | last post: by
8 posts views Thread by Henrik Stidsen | last post: by
1 post views Thread by raviviswanathan.81 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.