This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes How to Avoid User to do Ctrl+N and use the same session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to Avoid User to do Ctrl+N and use the same session" Watch "How to Avoid User to do Ctrl+N and use the same session" New topic
Author

How to Avoid User to do Ctrl+N and use the same session

Rajesh Savitri
Greenhorn

Joined: Sep 13, 2002
Posts: 21
In my application I need to make sure the user is using only one browser.
After logging in to my application and he does a Ctrl+N to open a new window. But since this request also shares the same session he is able to browse my application using two windows. I need to identify when a request comes from a second window and deny service in this window. How do I do this? Can some one help me out in this?
John Smith
Ranch Hand

Joined: Oct 08, 2001
Posts: 2937
Maybe you could use the "document.referrer" property of the document. If it is the same as the document requested, then you know the request came from the second window. Another property that can give you a clue is "document.history".
With that said, I should point out that this is not a Java question. HTML and JavaScript Forum is a better fit for your query.
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

I'll move it accordingly.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not block Ctrl-N and checking the referer is not going to work since if you reload the page it will not work.
Only thing I can say is you are going to have to keep track with sessions with a variable that is time dependent. Check that time when submitted. If it is not the version you are looking for error out.
My 2 cents
Eric
Rajesh Savitri
Greenhorn

Joined: Sep 13, 2002
Posts: 21
Eric,
Can you please explain me a bit more, what eaxctly I need to do...??
S Chandra Mohan
Ranch Hand

Joined: Oct 19, 2000
Posts: 75
hi
One way is that you can restrict it through Javascript functions.
The other way is that, u can check that a new screen comes out only when an event in that page occurs (Like, a page can be called only when an url or button in current page is clicked)
But u have to do R&D on this. I think u can get thru.


Have a wonderful day and wish u success<p>S Chandra Mohan<br />sc_mohan_us@yahoo.com
 
Consider Paul's rocket mass heater.
 
subject: How to Avoid User to do Ctrl+N and use the same session
 
Similar Threads
JSF Beginner
Is session object thread safe.
Tomcats session architecture
Need to avoid openging of page in a new window in IE
session issues with Ctrl-N