File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session destroy on window close

 
Rizwan Qadri
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to destroy the session by closing window. and I dont want refresh to work also . For that i have written code . But Its running on IE 6 but not on IE 7.
Please help.


<html>
<script>
function doUnload()
{
alert("doUnload");
if (window.event.clientX < 0 && window.event.clientY < 0)
{
alert("Window is closing...");
}
}
</script>
<body onunload="doUnload()">

</body>
</html>


Thanks,

Rizwan
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rizwan Qadri wrote:Hi,
But Its running on IE 6 but not on IE 7.


Did you allow IE to run scripts? (you know, that annoying yellow bar..?)

As a sidenote, you shouldn't rely on onunload, the user might have disabled JS or he could kill IE's process using the task manager, in neither case would your handler be called!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only deterministic way to do this is to rely upon the session time-out.
 
Rizwan Qadri
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the question remains that why it is running in IE 6 but not in IE 7?
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rizwan, the question remains: is JS enabled in IE7..?
 
Rizwan Qadri
Ranch Hand
Posts: 40
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya, JS is enabled in IE7
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try with || instead of &&! And good luck with making it work in other browsers!

(Btw, how is your problem related to JSP..?)
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic