Re: Writing to iframe issue with Internet Explorer
- From: VK <schools_ring@xxxxxxxxx>
- Date: Mon, 31 Mar 2008 10:39:27 -0700 (PDT)
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.
.
- References:
- Writing to iframe issue with Internet Explorer
- From: saraiva
- Writing to iframe issue with Internet Explorer
- Prev by Date: Re: how to trim file path from filename
- Next by Date: Re: how to trim file path from filename
- Previous by thread: Re: Writing to iframe issue with Internet Explorer
- Next by thread: dynamic table issue in Firefox
- Index(es):
Relevant Pages
|