Child WIndow가 닫혔는지 조사하기

iamgun(46)
Published in
#it
Words
25
Reading
1 min
9y
Listen to this post
~1 min

먼저 child window가 열려있다가 가정합니다.

win = window.open(...);

다음은 setInterval로 0.1초마다 Child WIndow가 살아있는지 체크하니다.

var timer, win;
function polling(){
if (win && win.closed) {
clearInterval(timer);
alert('popup window is closed.');
} 
}
timer = setInterval('polling()',100);