What I was anticipating was that I will get a trigger on trying to close the tab, but that has not happened.
Am I missing some basic fundamentals or something else is going wrong?
Hi there sir, I was able to get things done not by that function, but by mouseleave function.
var mouseMoveY = 0;
document.addEventListener("mouseleave", mlfunction);
function mlfunction(){
if (mouseMoveY < 1) {
alert("You are my captive you cant leave");
}
}