• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

closing all windows spawned from a frame

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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,
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Anne Forumer
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Once upon a time there were three bears. And they were visted by a golden haired tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic