**NOTE: This codebank submission is outdated and no longer works with modern browsers**
A common question on the forums is, if the user closes the browser window, how can they be logged out immediately?
Here's how. Have the following javascript in your window
The part in red, logout.html, can be replaced with any server-side scripted page in ASP/PHP/ASP.NET/WhateverFloatsYourBoat. That page should abandon/clear your sessions.Code:<script language="JavaScript"> function initUnload() { var top=self.screenTop; if (top>9000) { var settings = 'width=1,height=1,left=1,top=1,toolbar=0,scrollbars=0,status=0' window.open("logout.html?close=true","logoutWindow",settings); } else {//:ehh: } } window.onunload = initUnload; </script>
Keywords:
Session
Logout
Window
Close
logging out
user


Reply With Quote