aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes closing all windows spawned from a frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "closing all windows spawned from a frame" Watch "closing all windows spawned from a frame" New topic
Author

closing all windows spawned from a frame

Anne Forumer
Ranch Hand

Joined: Apr 19, 2004
Posts: 72
I have several links that are in the frame of a window. The containing window is generated by an application. Please note that I do NOT have any control over the containing window. That means I cannot write any scripts in it's <HEAD> tag. However, I do have control of the contents of the frame the links are in. I have specified the links to open in their own target windows - and they do.

I'd like for all these child windows to close when the containing window, mentioned above, is closed.

Is there a way to accomplish this?

Thanks
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
hi,

Your containing window is a page with few frames , this is my understanding ! Is it possible for u to store all the handles of the child windows in ur parent window ( this window which has all your links). Once you have the handles u can close those child windows in the onUnload() or onBeforeUnload() of ur parent window.
But if you refresh ur parent window, u wll loose all the handles stored in the array of ur parent window.

Thanks,


SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60059
    
  65

Rajeev, JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.

I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.

Please read this for more information.

thanks,
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Anne Forumer
Ranch Hand

Joined: Apr 19, 2004
Posts: 72
I apologize I misspoke in my original question.

I do have access to javascript in the header of the containing window. In it I do have a javascript function "closeChildWindows" which, I thought, would close all windows spawned from the frame containing the links. I do open these links in their own windows with the same names specified in "closeChildWindows" function. However, it seems that closeChildWindows function doesn't "see" these names of child-windows.

How can I have javascript "see" the names of the spawned windows?

Thanks
Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
Bear , I will try to avoid the abbreviations. I really got used to it..


Anne,
Have a look at the html source, hope it helps you .. It was very simple but you know what I spent around 2 hrs to make it out.. I was trying to invoke a child window function from parent window. my bad !! anyway have a look at the html !!

Anne Forumer
Ranch Hand

Joined: Apr 19, 2004
Posts: 72
Rajeev,

I appreciate you putting the effort. But it doesn't answer the question. The child windows are opened from a frame with target windows of known names.

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Rajeev, You could have looked at this: http://radio.javaranch.com/pascarello/replyToComment.action?entry=1106152877000&comment=1123403828551 and saved yourself the two hours!

Anne,

You would need to add the onunload event handler to the body tag calling the name of the function that closes all of the windows. The windows have to be opened by JavaScript and not regular HTML for them to be closed.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: closing all windows spawned from a frame
 
Similar Threads
Creating url links inside a Swing applet?
openwindow iframe conflict
Tracking browser events in applet
Closing Child Window from frameset
session problem