<Html>
<head>
<title> New Document </title>
</head>
<script language="JavaScript">
function getUrl(url)
{
var result = null;
var request = false;
if (window.XMLHttpRequest)
{
request = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
request = new ActiveXObject("Microsoft.XMLHTTP");
}
if (!request)
alert("Error initializing XMLHttpRequest!");
else
{
request.open("GET", url, false);
request.send(null);
result = request.responseText;
}
request = null;
return result;
}
function onWindowClose()
{
//var url = "http://www.google.com/"; // for local file
//var url = "/logout.ASP";
var url = "/";
var s = getUrl(url);
alert(s);
}
function mouseIsInXButton()
{
return (event.clientY < 0) && ((document.body.offsetWidth - event.clIEntX) < 30);
}
</script>
<script language="JavaScript" FOR=window EVENT=onbeforeunload>
// x button / alt+f4 / ctrl + f4
if( mouseIsInXButton() || event.altKey || event.ctlKey)
{
onWindowClose();
}
</script>
<body>
Clear session on window close
</body>
</Html>