The moose likes HTML, CSS and JavaScript and the fly likes window.opener problem 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 "window.opener problem" Watch "window.opener problem" New topic

window.opener problem

shiva sarna

Joined: Jul 23, 2006
Posts: 23

I am working on struts but needs to write a javascript function on my jsp.

My present jsp (which is a pop up)is called by action class.

On hitting the close button I am supposed to send the user to action class and reload the parent page.

The fuction goes like this:

function xyz()

Though this does close the child window BUT it reloads the page using class and not class.

Please tell me if there is any way by which I can reset window.opener so that the parent window is reloaded using and not
action class.

Thanks in advance for yr help.



SCJP 5.0
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You should be setting the url of the parent not the child

window.opener.location.href = "Sc....";

Don't do the reload()

shiva sarna

Joined: Jul 23, 2006
Posts: 23
Thanks Eric for your reply..will check this out on Monday and let you know. I just hope the page reloads without calling the reload() function as I want the new data to appear on the page.

thanks a lot...will let you know if it worked.
shiva sarna

Joined: Jul 23, 2006
Posts: 23
Hi Eric,

It did work but the page is getting refreshed only once.

My module is like a calendar where the user can add events for the dates as soon as he adds the events(The add window is a pop up window) I want the calendar to get refereshed showing the events beside the selected date.

I did do window.opener.location.href="";

but it refereshes the page only once and next time it just closes the pop window without refereshing the page.

I think I need to reset window.opener.location.href every time I open the add window but I don't know how to do it.

Please help me how to go ahead with this.

thanks for your help


I agree. Here's the link:
subject: window.opener problem
It's not a secret anymore!