File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

User closing browser

 
Joe Busch
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a simple way to have the browser send a Logout request if the user should close the browser window?

Thanks,
Joe
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no reliable way to do this.

This is a very common question, search through this forum for previous conversations on just this topic.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One solution was to use a pop up window, but pop up blockers blocked this idea. You basically have to rely the session to timeout on the server and handle it that way. PLUS there is no real way to detect a back button verus a link verus a refresh verus a close.

OR

make sure to tell your users to log out or they will never be allowed back in!

Eric
 
Joe Busch
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the responses. I was thinking I would have to do it on the server. I was looking at using the onUnload to send a logout to the server, but the only way I could see sending it via the javascript below left me with a taskbar icon that had an error 404:

<script language="JavaScript">
function autoLogout()
{
var iX = window.event.clientX ;
var iY = window.event.clientY ;
if (iX < -1000 && iY < -1000)
{
var winExit = window.open("/hostfolder/Logout.com", "", "height=1, width=1, left=1000, top=1000, toolbar=0, menubar=0, status=0, resize=no");
}
}
</script>
...
<body onUnload="autoLogout();">
...

If you think this has any merit let me know.
Thanks again,
joe
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using the onUnload to send a logout to the server


Think for a moment about when onunload is invoked. Is this really what you want to do?

Your best bet is to just rely on the session timeout.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic