I am opening a popup window and attaching an onbeforeunload event to it like this:
win = window.open(\"http://www.google.com\", \"\", \"width=300px,height=30
You could listen to the 'focus' event of the opener window which fires when the user closes the popup.