Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

capturing page load

0 views
Skip to first unread message

miha.vi...@gmail.com

unread,
Mar 29, 2007, 6:51:33 AM3/29/07
to
Hi all. I know this is more of a DOM question, but here it goes:

Browser == Firefox

suppose I have two frames. One has many links and is opening pages in
the other one. I would like to check if the page is finished loading.

This is the example of the "links" frame.
----

<html>
<head>
<title>Frame1</title>
<script type="text/javascript">
<!--
function loadDocument() {
content = window.open( "frame2.html", "Content" );
content.addEventListener( "load", sayDone, false );
}

function sayDone() {
alert( "done" );
}

//-->
</script>
</head>
<body>
<input type="button" value="Open frame 2" onclick="loadDocument()">
</body>
</html>

----

The problem I'm having is, that this only works the first time. If I
click on the button again, the load event is not captured. I didn't
find anything useful when searching the web. Can anybody here help?

Thanks in advance, Miha Vitorovic

-Lost

unread,
Mar 29, 2007, 8:08:31 AM3/29/07
to
<miha.vi...@gmail.com> wrote in message
news:1175165493.7...@n59g2000hsh.googlegroups.com...

I did not test this, it is merely conjecture. Did you try closing your Window instance?
Perhaps in the sayDone() function you can test if it is open, then close it:

if (content.open) { content.close(); }

Remember, that even after closing your Window instance, the Window object remains. It is
by testing further for the name property, that you see it is null (after closing your
instance).

-Lost


miha.vi...@gmail.com

unread,
Mar 29, 2007, 8:16:53 AM3/29/07
to
On Mar 29, 2:08 pm, "-Lost" <missed-s...@comcast.net> wrote:
> <miha.vitoro...@gmail.com> wrote in message

Tnx for the suggestion - no luck.

Br, Miha Vitorovic

-Lost

unread,
Mar 29, 2007, 8:51:33 AM3/29/07
to
<miha.vi...@gmail.com> wrote in message
news:1175170613.5...@y80g2000hsf.googlegroups.com...
> Tnx for the suggestion - no luck.

Do you have a page one can take a look at? I could not imagine that you need to remove
the event listener upon closing your Window instance, but, I could be wrong.

-Lost


miha.vi...@gmail.com

unread,
Mar 29, 2007, 9:22:40 AM3/29/07
to
On Mar 29, 2:51 pm, "-Lost" <missed-s...@comcast.net> wrote:
>
> Do you have a page one can take a look at? I could not imagine that you need to remove
> the event listener upon closing your Window instance, but, I could be wrong.
>
> -Lost

Sorry, can't do. But I can e-mail you the three HTML files. I's some
13k.

Br, Mike

0 new messages