A
A
Alex2015-11-12 14:36:26
JavaScript
Alex, 2015-11-12 14:36:26

How to assign a window close event handler?

I open a new window:

window.popup = window.open('http://some.url', 'popup', 'width=572,height=570');

How to catch event, closing of the given window?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Murat Atila, 2015-11-12
@TheExplay

Try to do so, he recently dealt with this topic.

var tab = window.open('', '_blank');
tab.location;
tab.document.write('<body"> try to close </body>');
tab.window.onbeforeunload = function () {
        console.log ("Tab closed");
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question