In web application, it is common that user sign in, do some work and close browser(By clicking X) with doing proper Sign Out. In such case, user session is still active and will be cleared only after specified session out period. If the specified timeout is small than it should not be problem. But if specified timeout is long in that case it is important to clear user session on browser close becuase clearing session on server will remove unused objects from server and hence reduce memory leak.
Here is possible solutions to handle it.
1) One approach is to use frames in your application. After user Sign In, Load application in Frameset as below.
<FRAMESET rows="0, *" onbeforeunload="javascript:callServer()">
<FRAME src="sessionFrame"> // Blank frame unloaded when browser close.
<FRAME src="mainFrame"> // Your Application pages
</FRAMESET>
When user closes browser(By clicking X), it will unload frameset and call callServer() javascript function. In callServer() function make server call(using XMLHttpRequest or submit Html Form) to clear session.
Welcome to Java Junction. Java junction talks about latest Java & related Web Technology.
Subscribe to:
Post Comments (Atom)
ORM Framework for Kotlin
In Kotlin, ORM (Object-Relational Mapping) libraries provide a convenient way to interact with databases using object-oriented programming p...
-
Feature Comparison Feature Liferay(5.1+) JBoss Portal(2.7) Out of the box Tools Has rich set of out of the box portlets Not too muc...
-
OSGi technology is Universal Middleware. OSGi technology provides a service-oriented, component-based environment for developers and offers...
No comments:
Post a Comment