In my application I have to forcefully log out user when they close tab or browser.I have logout function and I want to call it when user closes tab/browser.I have tried this piece of code but it didn't worked for me
<script type="text/javascript">
$(function () {
$(window).bind("beforeunload", function () {
fnLogOut();
})
});
function fnLogOut() { alert('browser closing'); }
</script>
Any help?