I have a main window and a popup. A popup window is created in the main window.
Like parent.php , the main window. On this page, I have a JavaScript function to reload the page, as shown below:
function popUpClosed() { window.location.reload(); }
We can open the popup from parent.php. Now I want to execute the popUpClosed() function on parent.php from the popup when we close / move the popup.
I tried the following methods to achieve the same.
Method 1
window.onunload = window.onbeforeunload = function() { if(window.opener && !window.opener.closed) { window.opener.popUpClosed(); } };
Method 2
window.onbeforeunload = Call; function Call() { if(window.opener && !window.opener.closed) { window.opener.popUpClosed(); } }
Method 3
window.onpagehide = function() { window.opener.popUpClosed(); }
Everything works fine in every browser except Google Chrome. Chrome does not run any feature.
However, this has occurred in the last 2-3 days. Everything used to work well in Chrome before. (This may be due to the latest Chrome updates)
Any suggestion would be appreciated.
source share