Event when javascript opened/popup window is closed

If you need check if the popup window was closed by javscript, you can use this ↓

<script type="text/javascript">
function open_popup(url)
{
     var popup = window.open(url, "", "width=450,height=250,resizable=yes,scrollbars=yes,status=yes");
    var windowCheckInterval = setInterval(function() { windowCheck(); }, 350);
        // Check function
        function windowCheck() {
            if (!popup || popup.closed) {
                clearInterval(windowCheckInterval);
		alert('popup window closed');
            }
        }
}
</script>

and ↓

<a onclick="open_popup('http://www.google.com');" href="#" >
   Open google in popup window
</a>