jquery.idle icon indicating copy to clipboard operation
jquery.idle copied to clipboard

How to kick out after closing the tab

Open mralperem opened this issue 4 years ago • 1 comments

Hello i can kick out the user when i change the tab but when i close is and open it back the user wouldnt be kicked out. Can anyone help me with that.

$(document).idle({ onIdle: function(){ Swal.fire({ title: 'Oturum Sonlandırıldı', text: "5 Dakikadır herhangi bir işlem yapılmadığından dolayı oturumunuz otomatik olarak sonlandırıldı!", icon: 'warning', showCancelButton: false, confirmButtonColor: '#3085d6', confirmButtonText: 'Tamam' }).then((result) => { if (result.value) { window.location.href = "assets/includes/logout.php"; } }); }, onShow: function(){ window.location.href = "assets/includes/logout.php"; }, idle: 3000 // Kick out after 1 Minute (60000 ms is equal to 1 min) })

mralperem avatar May 25 '20 18:05 mralperem

I'm pretty sure that when you close the tab, all the timeouts that were set go away with the tab. Maybe you are looking for something like this https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload

henriqueboaventura avatar May 25 '20 19:05 henriqueboaventura