To attach unload event, unload()
method can be used. Generally used with window object.
<script>
$(window).unload(function () {
alert("Hope this was a good time, bye. See you again soon!");
});
</script>
In the above code when user tries to close the browser window he/she will be alerted with “Hope this was a good time, bye. See you again soon!” message.
Views: 5129 | Post Order: 88