Log in

View Full Version : How to identify the browser instance using javascript


srinivasITB
May 30, 2007, 12:02 AM
Hi ,
I am web developer in CGI-PERL. I developed the project, which manages the session too.
But I have problem with the browser. I am keeping the session id in the url itself. After I login , if I open another window using File->New->Window it is opening another browser instance with the same url. So I am not able to identify which is first instance. Can anyone give me solution how to solve this problem... I am thank full to them

Regards
Srinivasa Rao

jstrike
Jun 1, 2007, 09:15 AM
It sounds like you want to be able to login in one browser, open another browser from the menu and be logged in but be able to identify that the new computer is not the one that initially logged in.

I'm almost certain that you are not going to be able to do this using the menu or ctrl-n options... There might be a work around but keep in mind that there are reasons browsers share the same session and any solution could get messy, especially if the servers are behind a load balancer.

When the first browser logs in you could add a parameter to the URL after the session id...

http://www.myurl.com?sessionid=..whatever..&compid=1
Instead of using the file menu or ctrl-n to open a new browser place a button on the page that will use JavaScript to increment the id and open the URL in a new window.

http://www.myurl.com?sessionid=..whatever..&compid=2
In your Perl scripts you could then use the compid as part of the name you use to store the info in the session.

This is a pretty ugly solution but it might work with some tweaking...

HTH.