I tried onbeforeunload event but it's not working when leaving the page it's only working when I reload but every thing works fine on edge. I think Chrome have changed somethings in configuration. Is there a way to fix that or another method?
onbeforeunload = function(){
return("bye");
}
AND is there a way I can check if user is closing the page or redirecting to another url with out firing on reloading or can I not do that?