I´m trying for a while execute a javascript function when a user leaves web site by typing a address in the browser and hits return or the user closes the brower clicking in the 'x' button.
I tried the unload event but I cannot get the alert
this is what I am doing:
$(window).unload(function () {
alert("Are you sure?");
});
also
$(body).unload(function () {
alert("Are you sure?");
});
I am running out of idea!