Reputation:
Am having a problem with session which is when in my web application different users are logged in then the same session is shared across multi tabs. Problem is i track single session in a browser to perform such process. Is there any possible way to keep session for tabs in JSP & Servlet. I can't invalidate session when duplicate or other user's logged into same application. Am stuck with this.
Upvotes: 2
Views: 4277
Reputation: 321
The server (where your jsp/servlet lives) is generally not in a position to tell if a link is opened in the same window or a new tab/window; that is unless of course the client (in this case web browser) tells it. Simply put; some client side code will do.
You could use the HTML5 window.sessionStorage object. A new instance of this object is created for each tab/window. Therefore generate a random id and save in session Storage per Browser Tab. Then each browser tab has his own Id. Communicate this id to the server...
See this answer by Gonzalo Galloti
Hope this helps
Upvotes: 2