0

i have the following javascript

    <script type="text/javascript">
    window.onbeforeunload = function (beforeclose) {

        var message = 'Are you sure that you want to close the greenhouse!!!';
        if (typeof beforeclose == 'undefined') {
            beforeclose = window.event;
        }
        if (beforeclose) {
            beforeclose.returnValue = message;
        }

        return message;
    }
    </script>

This method is an alert for the user before closing. What i want is to use a method after closing the window. Like: "When the following page is closed, do something". Is there not something like onafterunload?

user3346509
  • 57
  • 1
  • 7

2 Answers2

0

No, there is not as after unload is when browser or tab is closed then you can't run. Yes you can handle server side session out event.

Zaheer Ahmed
  • 28,160
  • 11
  • 74
  • 110
0

No there are not such event available but You can use:

$(window).unload(function() {
    //do something
}
Neel
  • 11,625
  • 3
  • 43
  • 61