[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document updates cause delayed crash?

Hopefully you won't get two of my messages.  I just typed something that
made Eudora drop the message I was writing to you!

Anyway, as far as I know (and from the comments by Brendan Eich,
JavaScript's developer), document.clear does nothing.  You might as well
take it out of your code.

As for testing if a document has been closed: I don't think there is an
explicit test for this, but it can be done implicitly.  You know Netscape
hasn't finished loading the page until the onLoad event has fired.  You can
use that to set a variable or run a function.  It is a problem when content
in one frame references another frame that hasn't loaded yet. Again, this is
where frame syncrhonization can come in.  When this is a problem, you can
set up tests in the links frame to ignore events until the whole frameset
has been loaded -- or at least the frame you want to reference has been
loaded.  One way is to check of the frame exists, which you can do with
parent.framename == null.  If the result is true, then you know the frame
doesn't exists yet.  

Another way is to set a variable in the frameset document when the frameset
is loaded (onLoad=... in the <FRAMESET> tag).  You can then reference that
variable from your frames to determine when it's save to proceed.

If you are writing content to your frames using JavaScript, the onLoad event
is never fired, even if you use the document.close method for that frame.
I'm unsure how to time things for JS-generated content, except maybe for
some hacks like inserting a hidden form element at the end and testing for
its existence.  There's probably a better way, but....  (hummmm).

-- Gordon

At 07:29 PM 3/22/96 +1000, you wrote:
>Hi all,
>I know that document.clear() doesn't work and that the 
>workaround is
>to use 
>	document.close();
>	document.open();
>instead. I would like to know, however, if document.clear() does 
>anything at all. If so, is it safe to leave it in my code?
>On a related matter, how can I tell if a document is open or 
>closed? I know that it is bad to force a close of a document 
>while it is loading/laying out. How do I tell when load/layout 
>is complete? I know of the onLoad method, but I also know that 
>there are bugs with that too.
>The document which I am working on has several frames. Selecting 
>a link in one frame causes two other frames to redraw themselves 
>with new text using writeln() statements (one also displays a 
>gif (with width and height specified) when necessary). Is it 
>possible for someone to select links in the first frame (thereby 
>updating the other frames) fast enough that Navigator is 
>attempting to close a document in another frame before the 
>document has closed itself?
>When I select lots of links rapidly the updates seem to occur in 
>an orderly fashion, one after the other, but I quickly run into 
>problems very soon after (Navigator sometimes crashes if I 
>select something in one of the updated frames).
>Any help on any of these topics would be greatly appreciated.
>Thanks in advance.
>Clayton Drury
>New Logic.
-- Gordon

For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/