2
I’m developing a system that stores in the database when user logs in and out. However, the logout function is only called when the user clicks out.
I was wondering if you can call the logout function when the browser closes or the session ends.
2
I’m developing a system that stores in the database when user logs in and out. However, the logout function is only called when the user clicks out.
I was wondering if you can call the logout function when the browser closes or the session ends.
1
You could try using the 'onunload' function'
<body onunload="funcaoEventoSair()">
<script>
function funcaoEventoSair() {
alert("SAIR"); // colocar sua lógica de log off aqui
}
</script>
another alternative:
<script>
window.onbeforeunload = function(){
alert("SAIR"); // colocar sua lógica de log off aqui
}
</script>
Browser other questions tagged php codeigniter
You are not signed in. Login or sign up in order to post.
If the above linked solution or answer below does not resolve, please [Dit] post by further detailing the peculiarities and requirements of your case.
– Bacco