JavaScript method to detect if a pop up window has closed
- 2020-05-17 04:48:35
- OfStack
This article demonstrates an example of how JavaScript detects if a pop-up window has closed. Share with you for your reference. The specific implementation method is as follows:
var win = window.open('foo.html','windowName',"width=200,height=200,scrollbars=no");
var timer = setInterval(function() {
if(win.closed) {
clearInterval(timer);
alert('closed');
}
}, 1000);
I hope this article has been helpful to your javascript programming.