Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

need to refresh web page after clicking close on pop-up window

I have a pop-up window a user logs into, once they are logged in successful, I have a message that has a link to close the window. But I want it to not only close that pop up window, but I want it to refresh the webpage the pop-up window was clicked on.

So the page can refresh to see that there is a valid login session for that user.

Is this possible w/ jQuery?

like image 596
Brad Avatar asked Mar 26 '10 13:03

Brad


People also ask

How do I trigger browser refresh?

To hard refresh on Google Chrome on Windows, there are two ways you can do it: Hold down Ctrl and click the Reload button. Or Hold down Ctrl and press F5.

What is the difference between browser refresh and close?

When we refresh the page (F5, or icon in browser), it will first trigger ONUNLOAD event. When we close the browser (X on right top icon),It will trigger ONUNLOAD event.

How do I automatically refresh part of an HTML page?

Approach 1: One can auto refresh the webpage using the meta tag within the head element of your HTML using the http-equiv property. It is an inbuilt property with HTML 5. One can further add the time period of the refresh using the content attribute within the Meta tag.


3 Answers

In your popup window:

$('#closeButton').click(function(e) {
    window.opener.location.reload(true);
    window.close();
    e.preventDefault();
});

Reloads the parent page and closes the popup.

like image 143
Jan Jongboom Avatar answered Oct 22 '22 14:10

Jan Jongboom


You can do this:

window.location.reload()

It just tells javascript to reload the page, this is not dependent on jQuery.

like image 21
Nick Craver Avatar answered Oct 22 '22 15:10

Nick Craver


onclick="javascript:window.opener.location.reload(true);self.close();"
like image 1
Denmark Avatar answered Oct 22 '22 15:10

Denmark