<script>
var popup = window.open('https://www.youtube.com/watch?v=zkLk8HHGmyo', 'importwindow', 'width=500, height=200, top=100, left=200, toolbar=1');
var open = new Date();
var timer = setInterval(function () {
if (popup.closed) {
clearInterval(timer);
var close = new Date();
var diffMs = (close - open);
var diffMins = Math.round(((diffMs % 86400000) % 3600000) / 60000); // minutes
var diffSecs = Math.round(diffMs/1000);
console.log(diffMins +' dakika '+ diffSecs + ' saniye açık kaldı.');
}
}, 1);
</script>
aklıma gelen tek çözüm desem yeridir.