...

Ajax & onUnload

bengaltgrs
11-21-2007, 06:41 AM
I am trying to create a system that keeps track of which members are online and which are not. The issue I am running into is that I need a method to set the member's status to offline when they close the browser window. It will currently set a members status to offline if they go to a different page, but not if they close the window. The current function is set as the onUnload event of the body:


function onUnloadRequest()
{
xmlhttp = null;

if(window.XMLHttpRequest)
{
xmlhttp = new XMLHttpRequest();
}

else if(window.ActiveXObject)
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if(xmlhttp != null)
{
xmlhttp.open("GET", "ajx_change_status.php", true);
xmlhttp.send(null);
return xmlhttp.responseText;
}
else
{
alert("Your browser does not support XMLHTTP.");
}
}

shyam
11-21-2007, 07:37 AM
The issue I am running into is that I need a method to set the member's status to offline when they close the browser window. It will currently set a members status to offline if they go to a different page, but not if they close the window.
if u want to find out if a browser window has been closed...u can't

A1ien51
11-21-2007, 03:34 PM
Server really needs to do this with a session timeout unless you are polling the server, you can see when the polling stops.

Eric

bengaltgrs
11-26-2007, 01:19 AM
Do you know of any websites tutorials on either of these topics? I've been googling for a while with no real results.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum