Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

invalidating the session on closure of browser

 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi


I have to introduce licensing framewrok to my webapplication ..which mean to say that i will give the clinet saying that u can run only 20 clients using my webapp server ........for this we need to keep track of the sessions getting created .....................

But the problem is that if the user logsout properly then license system will be informed that one user is out .........but if one user closes the browser abruptly with out logging out ......then my license system has to wait till the session of that user expires ......................

I know that windows close event cant be caught( i am sure of this i hope) ........but is there anyway of informing the server that the user has closed his browser ................

If not above is there anyway from the server to ping back to all the active sessions and findout if the browser is opened r closed and then invalidate the session.................


Any help on this would be highly appreciated
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you ever been stuck in a string of pop-up ads where you close one and it opens another? It is possible.

The only thing I can think of is to use javascript to detect a window close in the pages that are only accessible to logged-in users. This detection would trigger a pop-up window to open. The pop-up's request will clean up the session on the server and send back a page telling the user that they should play nice and log out next time (even though it's taken care of).

The drawbacks to this approach is that a browser with javascript turned off or with a pop-up blocker might prevent it from working.
 
sreenath reddy
Ranch Hand
Posts: 415
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi marc

the tough thing is that how to detect the window close event is the main problem any idea on this ???
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My suggestion is to browse the web until you get stuck in a bunch of naughty pop-ups and view the source to see what the javascript looks like.

Just kidding.

I think there is an onUnload attribute for the body tag but I am not sure which browsers support it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic