Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2008, 10:55 PM
Authorized User
 
Join Date: Dec 2006
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to h@ckerz Send a message via Yahoo to h@ckerz
Default Closing all child window when browser is closed

Hi all,
I just want to ask help for my problem in my page.

Scenario 1:

I have two page, Page1(the default page) has created a child window when i go to page2 the child window created in Page1 is still open, then now Page2 created its own child window. When i close the browser how can i close the child window created by Page1. Since Page2 can easy close its child created using window.close.

Sceanrio 2:

I have two page, Page1(the default page) has created a child window when i go to page2 the child window created in Page1 is still open, then now Page2 created its own child window. When i click logout all child window created by Page1 and Page2 will be closed.


I hope you can help me this.

Part of requirement is not to close the child window created by Page1 when going to Page2.




................ h@ckerz ....................
If you can't join them.....HACK them
..................................................
__________________
................ h@ckerz ....................
If you can\'t join them.....HACK them
..................................................
 
Old July 17th, 2008, 01:04 AM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

I *THINK* this will work:

(1) Make sure that every window has a name. That is, when you create the window, make sure you give it a name:
    window.open("childPage.aspx", "CHILD", "...whatever..." );
and from the child:
    window.open("theBaby.aspx", "GRANDCHILD", "..." );

(2) Later, when you need to "find" that same window again (in page2 or wherever) you find it thus:
    var kid = window.open( "", "CHILD" );
notice the lack of URL there.

That *should* find the window and then you can do
    kid.close( );

BUT...

But I don't know if your user will get one of those annoying "an application is trying to close this window..." messages.

And the answer might vary by browser.

Let me know. I'd try it, but I need to get to sleep.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Close Child window automatically on closing parent vikas67k C# 1 August 26th, 2008 02:00 AM
Closing parent window from child window arnabghosh Javascript How-To 1 December 26th, 2007 01:18 AM
problem with closing the child window swarnap Javascript How-To 4 November 16th, 2006 12:54 AM
closed parent window when opened child window jaiwin Javascript How-To 0 October 8th, 2006 12:54 PM
Closing Child Window nickiii General .NET 2 March 31st, 2005 12:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.