homepage Welcome to WebmasterWorld Guest from 54.211.95.201
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
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();
}

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved