A
A
abra-cadabra2015-01-02 16:39:18
JavaScript
abra-cadabra, 2015-01-02 16:39:18

Execute js function before closing browser tab?

Such a situation is that you need to perform the function of displaying a pop-up window (the function itself works) before the user, being on the site, wants to leave it, i.e. closes the browser tab. How to catch this action? Are there similar solutions that worked in most popular browsers?
If there is no such solution, then tell me an option in solving this problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Pautov, 2015-01-02
@bootd

Watson, elementary!

A
Andrey Dyrkov, 2015-01-02
@VIKINGVyksa

There is an onload window loading event and an onunload event that is called before the browser closes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question