Hello, my question is how can I make a dialogue message when a user wants to close the page to confirm if they want to leave or want to stay on the site, I tried in many ways that I saw by other posts and none It works for me, thank you very much
xmlhttp.open("POST","LogoutAction",false); //esta es una de ellas.
and another would be through an onbeforeunload but it does not work either
window.onbeforeunload = function (event) {
var message = 'Sure you want to leave?';
if (typeof event == 'undefined') {
event = window.event;
}
if (event) {
event.returnValue = message;
}
return message;
};
$(window).on('beforeunload', function() {
var x =logout();
return x;
});
function logout(){
jQuery.ajax({
});
return 1+3;
}
I'm trying this and it only works in firefox