You should use the intervals to check when / if the window was closed. Here's how you do it:
win = window.open($(this).attr("href"),'width=800,height=600'); function checkIfWinClosed(intervalID){ if(win.closed){ alert('windowsClosed'); clearInterval(intervalID); } } var interval = setInterval(function(){ checkIfWinClosed(interval); },1000);
And here is a working example in fiddle
Hope this helps.
source share