How To Log when user clicks on the cross button through Ajax
-
I am handling one project in asp.net.Now I want to update my sql database when anyone leave the domain. So I need to call a stored Procedure when user leave page. And I can do it very easily if user click on logout button. But the problem arises when anyone just close the browser (by clicking cross button) or when he navigate away to another page (typing another address in address bar). Some ppl said that this can be done with Ajax script. Anyone please provide some coding for this?
Regards, Shimona
-
I am handling one project in asp.net.Now I want to update my sql database when anyone leave the domain. So I need to call a stored Procedure when user leave page. And I can do it very easily if user click on logout button. But the problem arises when anyone just close the browser (by clicking cross button) or when he navigate away to another page (typing another address in address bar). Some ppl said that this can be done with Ajax script. Anyone please provide some coding for this?
Regards, Shimona
-
I am handling one project in asp.net.Now I want to update my sql database when anyone leave the domain. So I need to call a stored Procedure when user leave page. And I can do it very easily if user click on logout button. But the problem arises when anyone just close the browser (by clicking cross button) or when he navigate away to another page (typing another address in address bar). Some ppl said that this can be done with Ajax script. Anyone please provide some coding for this?
Regards, Shimona
hey shimona 2, The issue can be dealed with javascript, Please go through the following html code that captures the close button click event
<html>
<head>
<script language="javascript" type="text/javascript">
window.onbeforeunload = myunload;
function myunload()
{
alert('Window is closing!!');
}
</script>
</head>
<body>
</body>
</html>Hope this helps Regards