is it possible to open a popup with javascript and then detect when the user closes it?

Viewed 93705

The question is pretty much all in the title.

Is it possible (and how?) to open a popup with javascript and then detect when the user closes it?

I am using jquery within the project so a jquery solution would be good. Cheers!

8 Answers

I thinks best way is:

const popup = this.window.open(url.toString());
popup.addEventListener('unload', ()=> console.log('closed'))
Related