473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

close all child windows when close the main window

>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
4 2879
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
<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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jrefactors | last post by:
>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...
2
by: Guy Babbitt | last post by:
I have an MDI application that starts an instance of a child form at application start. I have an event handler on a combo box checking for the selected value to change. When the select value...
3
by: Isabel | last post by:
How can you close all child browser windows that where open by a parent browser window? I have links on a parent (main) page that opens the child page as a separate browser. However, I need to be...
2
by: Paul | last post by:
Hi this is related to a previous post, hopefully just a bit clearer description o the problem. I have a parent form that opens a new form (child form) while still leaving the parent form open....
0
by: Tom | last post by:
Let's say I have an MDI parent that has 5 open child windows in it. Now let's say that I have a function in the MDI parent that attempts to close all the child windows. It's starts running, closing...
2
by: JohnR | last post by:
Let's say I have an MDI parent form with a textbox. If I create an MDI child form and, at runtime, move the MDI child window over the textbox on the MDI parent, the textbox appears in front of the...
7
by: Jaggu | last post by:
Hi , I need to close main window, once the child window succesfully opens else main window to remain. In my case when I close the main window immediately after the "window.open()" as mentioned...
12
by: Phil | last post by:
I can check for MdiChildren.Length=0, but which event handler should I put this in to detect when a child window is closed? TIA Phil.
1
by: michal.podlewski | last post by:
Hi All, I have a problem with a simple (as I thought till now) thing: I want to make a link in a child-window which would change site in the parent-window and along with closing child window. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.