Using javascript - On browser close event i need to update my database
Hai,
Using javascript, I need to update my database on browser close event
Im able to do it with IE but mozilla firefox does return undefined alwz for event.pageX property
<script>
function closeWindow(e)
{
var evtobj=window.event? event : e;
if(evtobj == e)
{
//firefox
// alert(e.clientX + ' * ' + e.clientY); You will find both the value is undefined.
if (evtobj.pageY)
{
alert("Your session gets invalidated");
}
}
else
{
//IE
//alert(e.clientX + ' * ' + e.clientY); The value will be your mouse last position.
if (evtobj.clientY < 0)
{
alert("Your session gets invalidated");
}
}
}
</script>
In body tag iam calling this function like below
<body onbeforeunload="closeWindow(event);">
In IE - evtobj.clientY is properly getting executed
My problem is in firefox, always returns undefined for evtobj.pageY
can anybody help me in fixing this issue
I am not sure if the code in your function was written to perform the task mentioned: "Using javascript - On browser close event i need to update my database"
function closeWindow(){
//perform the task at hand here.
}
I do not see the point of using the event "e" here because you already know what triggered the function closeWindow(). Al yiu have to do is write the database update statements.
Bookmarks