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:
Code:
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.");
}
}