File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes refresh parent window on child window close Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "refresh parent window on child window close" Watch "refresh parent window on child window close" New topic
Author

refresh parent window on child window close

rich werth
Ranch Hand

Joined: Sep 21, 2001
Posts: 57
I have a window that opens another window. When the child window closes I want to refresh the contents of the parent. Is there a way I can do this?
Thanks
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Make a javascript function e.g. Relaod() on the parent page that just calls 'window.location.reload()'
On the child page you can make a javascript function e.g. named Close() that calls the function on the parent page like this: opener.Reload(). This function should be called when the child window closes.
/Rene
[ July 01, 2002: Message edited by: Rene Larsen ]

Regards, Rene Larsen
Dropbox Invite
rich werth
Ranch Hand

Joined: Sep 21, 2001
Posts: 57
Thanks rene
I have a question though because it isn't working. Inside the child window I am calling a servlet and forwarding jsp data into there. The user does some stuff finishes and ends up with an html page that says "good job u did ur thing" press here to close. so i add the function to close the window but thre reload function doesn't get calledon the parent. is this bcuz we use netscape or because the parent changes becuase i am switching btwn jsp servlet to an html page?
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Try this:
Parent

popup

/Rene
rich werth
Ranch Hand

Joined: Sep 21, 2001
Posts: 57
Didn't work. No alert message either.
This is the parent

This is the child
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

I've just tried to call a HTML page, from this page I opened a popup witch had a link to a Servlet that returned the result via RequestDispatcher.forward() to a JSP page. On this page I made a link to call the parent window to reload the page and then close.
I did it in Internet Explorer 6, Netscape 4.79 and Netscape 7.0
It works for me without any problems...
Try to post your code
/Rene
Yuriy Fuksenko
Ranch Hand

Joined: Feb 02, 2001
Posts: 413
it very machine/browser dependandt.
At least for IE sometimes it closes your popup before actually reloading opener window. (may be it sounds silly, but I really had it more than ones).
try to put some delay before you call self.close().
setTimeout("self.close()",100);
vivek shankare gowda
Ranch Hand

Joined: Jul 13, 2011
Posts: 35
Is there any way to call self.close(); completely after it reloads..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: refresh parent window on child window close
 
Similar Threads
Updating parent JSP(without a page refresh) on pop-up action
dynamic DIV tag
refresh parent window from child window
Communication between Child and Parent Window
Refreshing Parent Window from Child