1
I need help creating a function in javascript/jquery to do the following:
- When user accesses my site, starts time counter.
- If the person tries to close the browser window/tab before a certain time, e.g. 5 sec, then performs a function.
- Now if the person spends more than 5 sec on the site the function will not be executed.
Have you tried using beforeunload? Here you explain more or less how it is http://stackoverflow.com/questions/1631959/how-to-capture-the-browser-window-close-event#1632004
– Cesar de Barros