aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes retain focus on child page while refreshing parent page 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 "retain focus on child page while refreshing parent page" Watch "retain focus on child page while refreshing parent page" New topic
Author

retain focus on child page while refreshing parent page

Sai Sudha Chaganti
Greenhorn

Joined: Jul 29, 2004
Posts: 4
Hi,

I have two jsps, one will be called from another.
On updating some info on the second jsp, the first jsp should be refreshed, but the focus should be retained on the child (2nd) jsp.

Any suggestions on this.

I wrote the following javascript code on the 2nd jsp.It is refreshing the parent(1st) jsp but the focus goes back to the parent jsp.I need the focus to be retained on the child jsp.For some reason self.focus() is not working in this case.

self.focus();
window.opener.location.reload(true);
self.focus();
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
FYI: refreshing the parent is most likely going to kill the parent child relationship since refreshing tha page destroys the window object that created the pop up window. There is no way to avoid this other then using frames which is ewww (a mess to maintain).

Other then that to answer your question, try using a timeout that fires the code.
var timer = window.setTimeout("window.focus()",500);

Eric
Terry Jeske
Greenhorn

Joined: Apr 06, 2004
Posts: 17
I have a similar problem, and was wondering if there was an elegant solution.

I process a form in a pop-up window using Ajax. I would like to fire a:



This obviously refreshes the parent window, and then closes the pop-up. In order to get this to work asynchronously, I fire these calls in my ajax_update_resp() callback function. It works in IE, but (shockingly) crashes my beloved Firefox.

If I do:


I am not guaranteed that the opener window will pick up the changes in time. I have thought about a small delay, but ouch -that is exact opposite effect I was looking for by using Ajax.

Any ideas, anyone?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: retain focus on child page while refreshing parent page