捕捉浏览器窗口关闭事件,关闭父窗口时关闭子窗口

在父窗口写:

var sonid = window.open ('"
+ url2 + "', 'newwindow', 'height=108, width=200, top="
+ top + ",left=" + left
+ ", toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, "
+ "status=no,titlebar=no,z-look=1,depended=yes,alwaysRaised=yes')

window.attachEvent("onunload", closeSonwin);
function closeSonwin()
{
sonid.close();
}

原文地址:https://www.cnblogs.com/ymecho/p/2993418.html