473,503 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prevent to open the SAME APPLICATION (with the same session) in two or more browser windows.

Everybody knows how to open (or clone) the same page that you are
viewing in a new browser window by CTRL+N or via File->New Window. the
question is how to PREVENT to open the SAME WEB APPLICATION (with the
same session) in two or more browser windows.

any ideas?

ja****@gmail.com
thanks in advance!!! =)

Jan 24 '07 #1
8 10982
<ja****@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
Everybody knows how to open (or clone) the same page that you are
viewing in a new browser window by CTRL+N or via File->New Window. the
question is how to PREVENT to open the SAME WEB APPLICATION (with the
same session) in two or more browser windows.

any ideas?
Firstly, apart from under exceptional circumstances, sessions are unique
irrespective of browser and/or user. That means the same 'user' (see below)
will always have a different session every time they access the web app,
even when running two copies of the browser on the same computer at the same
time, so you're on a bit of a non-starter with that one...

Secondly, the web app will have no idea who the 'user' is unless it uses
some sort of authentication mechanism i.e. the user logs in, or uses
Integrated Windows Authentication, which is quite common in corporate
intranets etc, but highly unlikely on the public Internet.

Therefore, unless your web app has some way of 'knowing' who the user is,
there's not much you can do to prevent the same user accessing the same site
more than once at the same time.
Jan 24 '07 #2
Thus wrote Mark,
<ja****@gmail.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.com...
>Everybody knows how to open (or clone) the same page that you are
viewing in a new browser window by CTRL+N or via File->New Window.
the question is how to PREVENT to open the SAME WEB APPLICATION (with
the same session) in two or more browser windows.

any ideas?
Firstly, apart from under exceptional circumstances, sessions are
unique irrespective of browser and/or user. That means the same 'user'
(see below) will always have a different session every time they
access the web app, even when running two copies of the browser on the
same computer at the same time, so you're on a bit of a non-starter
with that one...
Unfortunately, that's usually not the case. Most browsers share a cookie
jar (so to speak) when you open a new window or tab, and that's what most
users do and the OP alluded to. You have to run another instance of the browser
executable to avoid this. But at the end of the day, that's an implementation
detail of the browser.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jan 24 '07 #3
"Joerg Jooss" <ne********@joergjooss.dewrote in message
news:94**************************@msnews.microsoft .com...
You have to run another instance of the browser executable to avoid this.
That's right - that's what I said:
"even when running two copies of the browser on the same computer at the
same
time,"
Jan 24 '07 #4
Nope, this is what you said
" That means the same 'user' (see below)
will always have a different session every time they access the web app,
even when running two copies of the browser on the same computer at the same
time"
And this is incorrect. Most likely browsers will share same session if you
running 2 copies of the browser window on the same computer at the same
time.

George

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:u$**************@TK2MSFTNGP05.phx.gbl...
"Joerg Jooss" <ne********@joergjooss.dewrote in message
news:94**************************@msnews.microsoft .com...
>You have to run another instance of the browser executable to avoid this.

That's right - that's what I said:
"even when running two copies of the browser on the same computer at the
same
time,"

Jan 24 '07 #5
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OY****************@TK2MSFTNGP05.phx.gbl...
And this is incorrect. Most likely browsers will share same session if you
running 2 copies of the browser window on the same computer at the same
time.
I just tried it. I opened 10 instances of IE7 and pointed at my website - 10
different SessionIDs...

Then I opened one instance of IE7, pointed at my website and clicked Cltr-N
nine times - 10 different SessionIDs...
Jan 24 '07 #6
Thus wrote Mark,
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OY****************@TK2MSFTNGP05.phx.gbl...
>And this is incorrect. Most likely browsers will share same session
if you running 2 copies of the browser window on the same computer at
the same time.
I just tried it. I opened 10 instances of IE7 and pointed at my
website - 10 different SessionIDs...

Then I opened one instance of IE7, pointed at my website and clicked
Cltr-N nine times - 10 different SessionIDs...
Funny, IE7 and Firefox2 behave for me just as I've described (I'm testing
this with my ASP-based web mail site).

But that't no that point. The point is that this behavior (or a lack of it)
is an implementation detail, and simply cannot be relied upon.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jan 25 '07 #7
"Joerg Jooss" <ne********@joergjooss.dewrote in message
news:94**************************@msnews.microsoft .com...
But that't no that point. The point is that this behavior (or a lack of
it) is an implementation detail, and simply cannot be relied upon.
Absolutely.
Jan 25 '07 #8
On Jan 25, 8:57 am, Joerg Jooss <news-re...@joergjooss.dewrote:
Thus wrote Mark,
"George Ter-Saakov" <gt-...@cardone.comwrote in message
news:OY****************@TK2MSFTNGP05.phx.gbl...
And this is incorrect. Most likely browsers will share same session
if you running 2 copies of the browser window on the same computer at
the same time.
I just tried it. I opened 10 instances of IE7 and pointed at my
website - 10 different SessionIDs...
Then I opened one instance of IE7, pointed at my website and clicked
Cltr-N nine times - 10 different SessionIDs...

Funny, IE7 and Firefox2 behave for me just as I've described (I'm testing
this with my ASP-based web mail site).

But that't no that point. The point is that this behavior (or a lack of it)
is an implementation detail, and simply cannot be relied upon.

Cheers,
--
Joerg Jooss
news-re...@joergjooss.de
Ok, here's the deal: I was looking for a way to prevent users of my
website to open two or more instances of the same page. I must add
that my website is a game, so having multiple browsers opened is no
doubt an advantage. After reading this thread and trying out a couple
of things, here's what i did:
- user opens first instance of the page, he is not logged in.
- here i used javascript to attach a name to this window. the name is
a md5 hash of the php session_id , user ip, http_user_agent and
whatever else you want.
- the user logs in, then javascript checks if the window name is
correct.

- user opens another instance (Open link in new window)
- since user is already logged in, i check if the window name is still
the same . it's NOT ! .. i log out the user and force a new session
with a new id to be created and used in setting the window name.

what now ?
user has two choices: either continues to log in on this second page,
thus disabling the first page since the session id is different so the
page name will not match . this makes the first page log the user out
if accessed. Or the user will close the second page, returning to the
first but will find himself logged out.

That's it. And because of using the session id along with the ip and
user_agent this will also work if using two different browsers are
used or two different computers (IE and Firefox) : all you have to do
is put that key you created somewhere in a database, in a table where
you have your online users and checking every time to see if the user
has the same key or not.

I hope this helps and if you need a working example, I could send it
by email.

Feb 13 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2502
by: Dave Smithz | last post by:
Hi there, Users of my PHP DB application have complained that it seems to log them out every now and then. I actually assume this is when it has been idle for sometime as I use session variables...
1
3544
by: Justin Beckwith | last post by:
Hi all, I have a very basic ASP application in which a user is authenticated, a flag is set in a session variable, and a new window is opened. The file opened exists in the same application...
18
8814
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page...
4
3369
by: google | last post by:
Hi there, I've searched high and low for this, but it seems most people are looking to establish (and control) the relationship between a parent browser window and it's associated child window...
18
3363
by: Gleep | last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this. The goal I don't want clients to give out their usernames and passwords to friends, since the site...
5
8686
by: John Scott | last post by:
Ok..this a rather odd question/problem. I haven't really found a straight forward answer to how to handle this scenario, so I hope someone here can help. Here it is: I have an application...
9
2796
by: cendrizzi | last post by:
Hi all, I've read some stuff on this but can't seem to come up with a solution that works right. I have a semi-mature (yet very large and robust) internal web application that currently only...
20
3146
by: luqman | last post by:
If user login with the login control in ASP.Net 2005 and then just close the browser and then open the browser again, the login status shows, User still Login? Any idea, how to Logout the User...
0
7202
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7084
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5578
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5013
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.