RE: iframe ... does it have an innerHTML ?

Martinez, Andrew
Wed, 28 Jun 2006 14:12:50 -0000

It sounds like you answered your own question in your response email...but I
will respond just because there is another question you ask that you
didn''t already answer yourself.

Using document.write post-load does not fire an onload. It just resets the
document''s text/html.

A simple test:

An IFRAME is just a nested window context, with some quirks. So, opening a new
window is just like an IFRAME.

Lets go to www.google.com <http://www.google.com/>

In the URL/address bar, clear any text there.
Type:    javascript:document.write(''omg where did google go''
);
Press enter.
No onload, but google is now gone!


-Andrew Martinez

-----Original Message-----
From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
[mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On
Behalf Of Sam
Sent: Wednesday, June 28, 2006 10:05 AM
To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
Subject: RE: [Rails-spinoffs] iframe ... does it have an innerHTML ?

Important to remember that using document.open/close/write from javascript
during non-loading period will cause the current document context to reset,
meaning you lose what was previously there.

-          var iFrame = document.createElement(''IFRAME'');
-          iFrame.src = "/"; //pretty sure you don''t need
this
-          iFrame.contentWindow.document.body.innerHTML =
"blarrrrrrr";
-          iFrame.contentWindow.document.body.innerHTML += "more
BLARRRRRRRRR";

resetting the context of the enclosing body?  This means reloading an iframe
will ...  fire a body onload event or what?

are you sure it doesn''t reset the context of the iframe alone? (hopeful
look)

<take a moment to ready what was actually written>

  .. so using innerHTML avoids the context reset altogether...

thanks

</>

Sam