| Refreshing a page when closing a popup Close the popup and the page that opened it refreshes |
jerome

msg:3709069 | 10:37 am on Jul 28, 2008 (gmt 0) | Hi JSers ! I don't know much, if anything, in Javascript but I'm facing a problem I'm sure JS could solve. I have a page with a link that, when clicked, opens a popup with :
OnClick=window.open
Now, that popup performs its action and ends. The popup stays there and now offers a link to click in order to close it with :
javascript:window.close()
What I'd want to do is to send a "message", or some sort of trigger from the popup to the main page so that when the popup closes, the main page that called it refreshes itself. Can Javascript do that ? And if yes, how would you go about it ? Thanks for your help jerome.
|
gergoe

msg:3711031 | 10:23 am on Jul 30, 2008 (gmt 0) | On the first instance i'd sugest to try opener.reload() from the popup, but the decent solution is to make a callback function on the main window (say myReload()), which only reloads the page itself. Within the popup you can make a function like below, and call this function whenever you want to close that window.
function closeMe() { if (opener && opener.myReload) opener.myReload(); window.close(); }
|
|
|