473,574 Members | 2,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.h tml')">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 2892
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********@hot mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
From the main page, there are lots of links to open new window.

i.e. <a href="#" onClick="window .open('child1.h tml')">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 ShowModelessDia log() 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********@hot mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
From the main page, there are lots of links to open new window.

i.e. <a href="#" onClick="window .open('child1.h tml')">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 ShowModelessDia log() 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.javas cript
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 17 '05 #4
"Randy Webb" <Hi************ @aol.com> wrote in message
news:io******** ************@co mcast.com...
Chung Leong wrote:
<jr********@hot mail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
From the main page, there are lots of links to open new window.
i.e. <a href="#" onClick="window .open('child1.h tml')">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 ShowModelessDia log() 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.javas cript


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
3614
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 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...
2
9009
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 changes, I call a method on the parent form to change some menu options, and then I need to close the child form. My code looks something like this: ...
3
3740
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 able to close all the opened child browser pages from the parent page. Thank you for your help, Isabel
2
2899
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. Although the child form has a close button (with java script) if the user navigates the parent form to another form the child form is still open. Just...
0
1714
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 the child windows; however, let's say that the second window it attempts to close has a Closing event and in that event (for whatever reason) the...
2
14007
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 MDI child window. How can I make the MDI child window appear in front of any controls that may be on the MDI parent? thanks, John
7
2504
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 below, both the main and child disappears(this is due to pop up blocker) disappears suddenly. I want to make the browser know if pop up blocks the...
12
6219
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
4467
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 parent window name is "main". A made a link like this in the child-site: <a href="new_address.html" target="main" class="about"...
0
7815
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7738
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8077
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7828
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6476
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3755
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3765
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2253
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.