Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
70
rated 0 times [  74] [ 4]  / answers: 1 / hits: 31085  / 14 Years ago, wed, november 24, 2010, 12:00:00

Is there any way I can refresh the parent window when a popup window is closed without adding any javascript code to the popup window?



I have a page parent.php on which users can click open popup to open a popup window. This popup window shows some flash content and its not possible for me to add something like



window.onunload = function(){ 
window.opener.location.reload();
};


to the popup window page markup.



Is there any other method to achieve this?
Thanks


More From » jquery

 Answers
29

To make this work in all major browsers, you need to handle the unload event handler in the pop-up and do the reloading in the main window. In the main window, add



function popUpClosed() {
window.location.reload();
}


In the pop-up:



window.onunload = function() {
if (window.opener && !window.opener.closed) {
window.opener.popUpClosed();
}
};


So the answer to your question is generally no, if you need your code to work in all browsers, in particular IE.


[#94860] Sunday, November 21, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lamontm

Total Points: 482
Total Questions: 99
Total Answers: 91

Location: Burkina Faso
Member since Thu, Dec 15, 2022
2 Years ago
;