Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reload issue 1

Status
Not open for further replies.

leahyj

MIS
May 5, 2004
107
US
Hi,

Interesting problem. I have a page which opens a popup window in which users can type comments, and the popup window closes when the user clicks Save, and the javascript code closes the popup window and reloads the parent page to display the new comment.

Code:
function refreshPage()
{
window.opener.location.reload( true );
window.close();
}

This works fine on the initial parent page, but when I click on the next page in the pagination results, the reload doesn't happen when the popup window closes.

Thanks in advance for any help.
 
That's because when you reload the parent page the links between the windows are lost. Before you launch the child window, give the parent page a name.
Code:
window.name='mainpage';
Then you can relink the windows using the following:
Code:
function refreshPage()
{
  var mainpage = window.open('','mainpage');
  mainpage.location.reload( true );
  window.close();
}

Adam
 
Wonderful,

I will try it.

By the way, where and at what point do I give the parent page a name?

Thanks again
 
To adam0101:

I tried the code, but I got the same results.

 
adam0101, your code helped me on another post, here have a purple pointy thing.

[monkey][snake] <.
 
Do this:

put
Code:
window.name = "popupWindow"
in the popup window HTML, (I normally do it just after the <script> tag.

Then in every page that has to reference the popup window, put this just after the <script> tag:
Code:
var mainpage = window.open("","popupWindow");

I believe your refreshPage function should work as is with these changes.



[monkey][snake] <.
 
To monksnake:

I tried that one but, the problem got worse and my pages hung, plus I'm getting popupblocker requests, which I don't want.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top