PDA

View Full Version : Please Help with Reloading window



jehchoi1
Mar 5th, 2007, 07:28 PM
Can someone please help me!!!

I am trying to refresh or go back a page on parent window automatically when a pop-up window is closed by clicking on close button that I created.

Any suggestion is greatly appreciated.

BarrMan
Mar 5th, 2007, 07:38 PM
opener.window.location.href = unescape(window.location.pathname);

glenngv
Mar 5th, 2007, 07:45 PM
You have to repeatedly check from the parent window if the child window is open or not. You can't rely on the user clicking your Close button in the popup. You can't keep them from clicking the browser's X button.

Put this code in the parent window.


var childWin, timer;
function checkChildWindow(){
if (childWin && childWin.closed) { //popup is closed
clearInterval(timer);

//do what you want
//location.reload(true); //refresh parent page
//history.back(); //go back one page
}
}

function openChildWindow(){
childWin = window.open("popup.htm", "popup", "...");
childWin.focus();
timer = setInterval("checkChildWindow()", 500);
}

jehchoi1
Mar 5th, 2007, 08:03 PM
Wow!

I wasn't expecting such a quick reply back. :thumbsup:
Thanks a lot for you help guys. Everything worked fine

James