This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting two different sessions in two different tabs of same browser window

 
Pranav Pal
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since two tabs of same browser window share cookies, and session is maintained by embedding session-id in cookies, we get same sessions in two tabs of same browser window.

But is it possible to get two different sessions in two different tabs of same browser window by using some method like encoding URL?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can use URL encoding.
[ February 07, 2008: Message edited by: David O'Meara ]
 
S Reddy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But http://meebo.com does allow two sessions with in same window, without URL encoding. How it is possible? Can we do it in Java?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two possibilities occur to me:
1. write your own "session" mechanism and use hidden form variables to distinquish between forms in different tabs.
2. generate the contents of each tab from different URLs so the cookie mechanism considers them separate locations.

Bill
 
S Reddy
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you William Brogden.
 
Tahir Akram
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends;

I need more elaboration towards the solution, that how I can restrict the user if he is accessing my application from another tab.

How can I user URL encoding if this is the solution? and How it helps?
or any other idea to implement it.

--
tahir
 
Tahir Akram
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends;

I have some pointer on the my above problem that how can I identify that user is coming from tab.

if I access session.jsp from index.jsp then on second page I see session.isNew true and Refrer is my index page.

And if I try to open session.jsp directly from another tab then session id will be same, session.isNew false and refrer will be null.

session.jsp




see following cases:

1. User is log in to my site. session.isNew = true and Refere rwill be null (normal case, no action will be taken)
2. User has logged in and browsing my site. session.isNew = false and Refere will not be null (no action)
3. User has already a session and opened a tab and hit the url to login again. session.isNew = false and Refere will be null

in last case I can take action to redirect the user to some messge page that you already login and something like that.

so whats you people think ....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic