selimsoydann
Member
- Joined
- Jan 1, 2021
- Messages
- 5
- Programming Experience
- 1-3
hello I have a code like the one below. Here I want the session cleared as soon as the browser is closed. But when I close the browser, the script works, it goes to function, it runs my code. I am still logged in when I open the browser again. Can you help me.
JavaScript:
<script type="text/javascript">
$(document).ready(function () {
window.addEventListener('beforeunload',recordeCloseTime);
});
function recordeCloseTime() {
$.ajax({
type: "POST",
url: "Account/LogOut",
});
}
</script>
Last edited by a moderator: