Dear all
I need to know when th user browser is shutdown suddenly
so i need to run some code such as remove user ID from Vector or any another thing
so how can i do that , using what
thanks alot for help
-
Jsp-When Browser Closed (1 messages)
- Posted by: Mohamed Sayed Ahmed
- Posted on: May 13 2004 06:27 EDT
Threaded Messages (1)
- Using Javascript for IE6 by Trevor Brosnan on May 13 2004 10:26 EDT
-
Using Javascript for IE6[ Go to top ]
- Posted by: Trevor Brosnan
- Posted on: May 13 2004 10:26 EDT
- in response to Mohamed Sayed Ahmed
Well, as HTTP is stateless, you need the browser to explicitly tell the server that it is closing. There is no 100% perfect way to do this, so you will need to mess around with some client-side scripting. You can try using the onunload attribute of the <body> tag to run some script (i.e. a post) when the window closes.
I have used this for Internet Explorer 6, to process a form action when the window closes:
<html>
<head>
<script type="text/javascript">
function doUnload()
{
if(window.screenTop > 10000)
document.myform.submit();
}
</script>
<title>My Document</title>
</head>
<body onunload="doUnload()">
<form action="/myWebapp/logoff" method="post" name="myform">
<!-- possible hidden form fields here -->
</form>
</body>
I hope this helps somewhat