PHPBuilder - Automaticaly Logout

RSS Twitter

Automaticaly Logout

by: NightOwl
August 20, 2000

Different users have asked questions regarding logging users out of the system for various reasons. Sometimes, it's really necessary to know if a user has left your page or not. Javascript can help you with this. Although it's not a 100% optimal solution (maybe someone can comment on it), you might want to open a new window when your user leaves the first page. This new window should contain a PHP-page which logs the user out... Here's how you do it...
<script language = "javascript">

function Popup()
// open the popup window
var popupURL = "PHP_Logoutpage_URL_HERE";
var popup =,"Popup",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,');
// delete the 'toolbar ... scrollbars stuff' if you want a normal
if( navigator.appName.substring(0,8) == "Netscape" ) {
popup.location = popupURL;

<body onUnload="Popup()">


Hope this helps you. Always looking for any improvement... Mail

Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.