By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,826 Members | 2,384 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,826 IT Pros & Developers. It's quick & easy.

close all child windows when close the main window

P: n/a
>From the main page, there are lots of links to open new window.
i.e. <a href="#" onClick="window.open('child1.html')">Open Child
Window</a>

If I close the main page, I want to close all child windows also. That
means I
need to keep track all handles of the child windows whenever I open a
new
window. Correct? any suggestions on the approach?
Please advise. thanks!!

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
If I close the main page, I want to close all child windows also. That
means I need to keep track all handles of the child windows whenever I
open a
new window.


That won't work if user browses in main window.

IMO the best way is to simply add 'dependent=yes' to popup window
attributes.
Doesn't work everywhere, but when works - it works :)

BTW: never use href="#", put real address there and use return false in
onclick.
This will improve search engine visibility, ensure that windows open in new
window, links can be copied/bookmarked, etc.

--
* html {redirect-to: url(http://browsehappy.pl);}
Jul 17 '05 #2

P: n/a
<jr********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
From the main page, there are lots of links to open new window.

i.e. <a href="#" onClick="window.open('child1.html')">Open Child
Window</a>

If I close the main page, I want to close all child windows also. That
means I
need to keep track all handles of the child windows whenever I open a
new
window. Correct? any suggestions on the approach?
Please advise. thanks!!


Yes. Wouldn't be hard if you define a Javascript function for opening
windows and save the handles into an array.

Or you could use the ShowModelessDialog() function. Modless dialog boxes
stay in front of their parent window and automatically would close when the
parent closes.
Jul 17 '05 #3

P: n/a
Chung Leong wrote:
<jr********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
From the main page, there are lots of links to open new window.

i.e. <a href="#" onClick="window.open('child1.html')">Open Child
Window</a>

If I close the main page, I want to close all child windows also. That
means I
need to keep track all handles of the child windows whenever I open a
new
window. Correct? any suggestions on the approach?
Please advise. thanks!!

Yes. Wouldn't be hard if you define a Javascript function for opening
windows and save the handles into an array.

Or you could use the ShowModelessDialog() function. Modless dialog boxes
stay in front of their parent window and automatically would close when the
parent closes.


Modeless Dialogs are also IE-only.

I might be able to understand the OT if this were not posted to
comp.lang.javascript
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 17 '05 #4

P: n/a
"Randy Webb" <Hi************@aol.com> wrote in message
news:io********************@comcast.com...
Chung Leong wrote:
<jr********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
From the main page, there are lots of links to open new window.
i.e. <a href="#" onClick="window.open('child1.html')">Open Child
Window</a>

If I close the main page, I want to close all child windows also. That
means I
need to keep track all handles of the child windows whenever I open a
new
window. Correct? any suggestions on the approach?
Please advise. thanks!!

Yes. Wouldn't be hard if you define a Javascript function for opening
windows and save the handles into an array.

Or you could use the ShowModelessDialog() function. Modless dialog boxes
stay in front of their parent window and automatically would close when the parent closes.


Modeless Dialogs are also IE-only.

I might be able to understand the OT if this were not posted to
comp.lang.javascript


Oops. Why did the OP cross post into comp.lang.php?
Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.