Is it possible to catch browser close cross mark and ctrl w ??
I was trying with various thing as
// 1st option
window.onunload = function (e) {
// Firefox || IE
e = e || window.event;
var y = e.pageY || e.clientY;
if (y < 0) {
alert("close");
}
else {
alert("refresh");
}
}
// 2nd option
<body onunload="myFunction()">
function myFunction()
{
alert('sss');
}
// 3rd option
$( window ).unload(function() {
alert('window unload');
});
But nothing has working for me (Measn these alerts weren't coming when i click on cross mark button on browser or used Ctrl + W )
Could anybody please let em know how to resolve this ??