469,631 Members | 1,683 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

Closing child windows on Logout

15
Hi All,


I have a parent window where i have three links. On clicking those links, new window will be opened as a pop up. When i logout from the parent window, the child windows should be closed.


I can close the child windows when i close the parent window using the following code

The following function i am calling "onUnload" event in the body tag of parent window.

Expand|Select|Wrap|Line Numbers
  1. function closeDep() {
  2.  
  3.   if (win1 && win1.open && !win1.closed)
  4.    win1.close();
  5. }
  6.  
  7. function site(){
  8.  win1 = window.open('../../<%=username%>/test.jsp',''status=yes,scrollbars=1,resizable=yes,width=900,height=650');
  9. }
But i want to close the child windows, on clicking Log Out link, which is a different jsp and not the parent window page.

I am not sure whether i have posted the question in correct section or whether this should be posted in "Java" section.
Dec 12 '07 #1
5 2887
acoder
16,027 Expert Mod 8TB
Why are these windows not closed when you leave the original parent page? Do you need these open for another page?
Dec 12 '07 #2
Hey, did you find the solution?

I am having similar requirements.

Can you please post the solution here to help people like me having similar requirement.

Thanks in advancde,
Mahavir
Mar 3 '08 #3
acoder
16,027 Expert Mod 8TB
Hi Mahavir, welcome to TSDN!

Is it the same page or has the page changed since the child windows were opened? Show your code.
Mar 3 '08 #4
Thanks acoder for your reply,

Yes, the page can be and most probably changed since the chield window opened.
And yes, then the javascript wont help, because then javascript variables will loose their values.

So keeping a javascript array for chield window handles wont help.

Can we take these javascript values along with us to server trip for logout method, and while responce emmit some javascript which will take care of closing these windows? Or something like that.

Can you help something for this scenario?

Thanks,
Mahavir
Mar 5 '08 #5
acoder
16,027 Expert Mod 8TB
I haven't tested this, so it may not work, but you could try checking from the child window if the user has logged out in the parent window. Check periodically using setInterval().
Mar 5 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Ron L | last post: by
1 post views Thread by Chris Bruce | last post: by
6 posts views Thread by Barry Gast | last post: by
6 posts views Thread by **Developer** | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.