catch newWin.close 
Author Message
 catch newWin.close


Quote:
> Firstly, thanks.
> If parent html open a new window: newWin = window.open(""),
> parent can catch child window's close event?
> if can, how to handle with?

Hi,

In theory you can just say:

    newWin.onclosed = function()
    {
        // whatever
    }

But I don't know for sure if that will work. Note that these types of
questions are better asked in the non-.NET groups, like
microsoft.public.scripting.jscript

Peter

--

Waiting for the Vengabus? http://www.*-*-*.com/
Please post all questions to the group. Thanks.



Wed, 08 Sep 2004 10:29:56 GMT  
 catch newWin.close
Has this been answered yet?



Quote:


> > Firstly, thanks.
> > If parent html open a new window: newWin = window.open(""),
> > parent can catch child window's close event?
> > if can, how to handle with?
> Hi,

> In theory you can just say:

>     newWin.onclosed = function()
>     {
>         // whatever
>     }

> But I don't know for sure if that will work. Note that these types of
> questions are better asked in the non-.NET groups, like
> microsoft.public.scripting.jscript

> Peter

> --

> Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
> Please post all questions to the group. Thanks.



Thu, 09 Sep 2004 21:54:24 GMT  
 catch newWin.close
Actually, it has in a way...

Handling the unload event (AFAIK there is no onclosed event) will tell you when the page in that window is being navigated away *or* the window is being closed, but you won't necessarily be able to distinguish one from the other...

    newWin.onunload = function()
    {
        // whatever
    }

There is also a closed property on a window object so you should be able to test if the window has been closed with newWin.closed, but there is a bug in IE version up through IE5...

BUG: window.closed Property Returns Incorrect Values (Q241109)
http://support.microsoft.com/directory/article.asp?ID=KB;EN-US;Q241109

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--

Quote:

> Has this been answered yet?





> > > Firstly, thanks.
> > > If parent html open a new window: newWin = window.open(""),
> > > parent can catch child window's close event?
> > > if can, how to handle with?
> > Hi,

> > In theory you can just say:

> >     newWin.onclosed = function()
> >     {
> >         // whatever
> >     }

> > But I don't know for sure if that will work. Note that these types of
> > questions are better asked in the non-.NET groups, like
> > microsoft.public.scripting.jscript

> > Peter

> > --

> > Waiting for the Vengabus? http://www.microsoft.com/info/cpyright.htm
> > Please post all questions to the group. Thanks.



Fri, 10 Sep 2004 01:48:10 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. MSIE PC and window.newWin.document.write(someFunction()) problems

2. catching server-side ASP errors with catch?

3. Problems Closing a New Window using window.close()

4. Close all child windows when parent is closed

5. closing a popup when the parent closes.

6. Closing a child window when parent closes

7. Close popup closes out altogether

8. Close IE 5 without prompt for close window confirmation

9. catch the enter key in an input box (2nd problem)

10. Catch IPConfig

11. catching event

12. try catch statement

 

 
Powered by phpBB® Forum Software