I
I
Ivan13312021-10-07 11:21:31
JavaScript
Ivan1331, 2021-10-07 11:21:31

Call popup on page close?

I want to implement just such a thing: when a user wants to leave the page, I need a pop-up with a questionnaire to pop up. Tell me how can this be done? Did I understand correctly that this cannot be done through the beforeunload event? If not, then how, maybe someone had experience of something similar.
It would be ideal if someone suggested something like this

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Leonid Yakovlev, 2021-10-07
@Ivan1331

The easiest option:

$(document).mouseleave(function(){$('#leaveModal').show();});

You can read here (even with an example)
Or this option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question