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!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have control over the contents of the pop-up, handle the window’s
unloadevent there and notify the original window via theopenerproperty, checking first whether the opener has been closed. Note this won’t always work in Opera.Since the
unloadevent will fire whenever the user navigates away from the page in the pop-up and not just when the window is closed, you should check that the pop-up has actually closed insomeFunctionToCallWhenPopUpCloses:If you don’t have control over the contents of the pop-up, or if one of your target browsers does not support the
unloadevent, you’re reduced to some kind of polling solution in the main window. Adjust interval to suit.