Javascript: Auto refresh or reload parent window when closing a popup

Lets say you have a page that gets a user to click to open a pop-up window to prompt the user for the required action. When the user has completed the required action on the pop-up window, and clicks the button “close”, you want the parent window to be refreshed or reloaded for its content.

The few lines of Javascript code that can get this done are as follows:

1. On the page of pop-up window, we just need the following javascript function:

function reloadParentAndClose()
    // reload the opener or the parent window
    // then close this pop-up window

2. Place a button to call the above JavaScript function at the bottom of the pop-up window, so when user clicks on the button, it’ll refresh the parent window and closes itself.

<input type=button value=”Close” onClick=”reloadParentAndClose();”/>

Enter your email address to subscribe our newsletter or feed for FREE:

Delivered by FeedBurner

Bookmark with:

[Delicious]    [Digg]    [Reddit]    [Facebook]    [StumbleUpon]

0 Responses to “Javascript: Auto refresh or reload parent window when closing a popup”

  1. No Comments

Leave a Reply

You must login to post a comment.