Re: Writing to iframe issue with Internet Explorer



On Mar 31, 4:46 am, saraiva <pimentelsara...@xxxxxxxxx> wrote:
Hello.

My web site application has to write syncronosly to an iframe. It puts
in an iframe the directions came from google maps api. This is not an
error from google maps api.
i want the directions to be written in the iframe and in IE the
directions are overwritten, so the user can only read the last one....
In Firefox this works great, the directions are well written in the
iframe and the user is able to read them all, but in Safari and IE
they can't because the directions are all overwritten one by the
others....

My code to write to the iframe is this:

function iframeWrite(val)
{
var testFrame = document.getElementById("step");
var doc = testFrame.contentDocument;
if (doc == undefined || doc == null)
doc = testFrame.contentWindow.document;
doc.open();
doc.write("<span style='color:#000000; font-size:12px; font:Arial,
Helvetica, sans-serif;'>" + val + "</span>\r\n");

}

I only close the iframe writing after i have written all the content i
want on the iframe.....

It doesn't matter: IE and a number of other browsers automatically
close input stream on exit from the execution context. Firefox keeps
the input stream open until explicit document.close() command. This is
why you see so many dynamic pages in the Web with cursor in the
perpetual waiting mode if viewed in Firefox. Taking into account the
current low culture of the programming such "automatic code cleanup"
maybe not such a bad idea and maybe Firefox shouldn't be so strict. A
disputable matter.
In your case you simply cannot use document.write to keep your
solution cross-browser compatible. If the content indeed arrives by
chunks and you want to display each chunk as soon as ready, use DOM
methods instead to add content to your iframe.
.



Relevant Pages

  • Writing to iframe issue with Internet Explorer
    ... My web site application has to write syncronosly to an iframe. ... in an iframe the directions came from google maps api. ... var doc = testFrame.contentDocument; ...
    (comp.lang.javascript)
  • Re: Locks and Quays Series 3
    ... The content of the Help page is contained within a scrollable iframe ... Except that in Firefox the iframe has no scroll bar ... http://www.ronjones.org.uk/waterways/WWonFF.jpg shows a screen dump at the ... and I'm not certain about the universe. ...
    (uk.rec.waterways)
  • Re: Locks and Quays Series 3
    ... The content of the Help page is contained within a scrollable iframe ... Except that in Firefox the iframe has no scroll bar ... http://www.ronjones.org.uk/waterways/WWonFF.jpg shows a screen dump ... and I'm not certain about the universe. ...
    (uk.rec.waterways)
  • Re: FireFox and iframes
    ... Opera the iframe loads correctly (no scrollbars and sized correctly with ... In FireFox the scrollbar appears even though I have ... If you are using PHP why are you bothering with an IFRAME? ...
    (alt.html)
  • Re: editable iframe on the fly
    ... neither insert the innerHTML!? ... iframe to editable all about? ... [HTML] ... this works in IE but not in firefox! ...
    (comp.lang.javascript)