How to disable open in new tab?

G

Gunawan

Dear All,
I would like to know how to disable 'open in a new tab' or 'open in a new
window' feature coz I would like to maintain parameter using session id
which is not change if we using those two feature. In fact I would like to
make my web application stay on one web browser windows during the session.

Regards,
Gun
 
G

Guest

You can disable or even raplace the right click menu using JavaScript.
However opening pages in new windows does not affect the session at all. The
only way to end the session is to close all bowser windows/tabs or be
inactive for a period of time defined in your web servers config.

In short when you open in a new window, the session is maintained.
 
D

Damien

Gunawan said:
Dear All,
I would like to know how to disable 'open in a new tab' or 'open in a new
window' feature coz I would like to maintain parameter using session id
which is not change if we using those two feature. In fact I would like to
make my web application stay on one web browser windows during the session.

Regards,
Gun

But what if the user copies the address from the address bar and copies
that into a new window manually? Or they bookmark the page and use that
to get a second window open. Those are just two off the top of my head
- there would be other ways of circumventing this disabling.

Best is: Redesign the application to cope with this situation. Second
best is to warn the user at the outset, then if you detect something
has gone amiss, react to it (possibly with a large page of text that
says "I told you not to do that").

Of course, if your application is based entirely on postbacks and
server.transfers, you may be able to engineer it to detect the second
page being opened (Basics being that if you get into Page.Load,
IsPostback is false, and nothing has been manually added to the
HttpContext to indicate that a Server.Transfer has occurred, then you
know that it's a fresh page request, and you should react accordingly)

Damien
 
G

Gunawan

ClickOn and Damien, Thank you for your reply.

What I want to do is maintain Session. If user open a new windows by
copy/paste
on the address bar, it is seems no problem as long as they have different
session id.

What I would like to do is to prevent the same session id from many web
browser
windows. For example I would like to maintain value of product id in
session, then if
user open the same page on different windows then I would be confuse what
the right
product id for each web windows.

Thank you,
Gun
 
A

Alan Silver

Gunawan said:
What I would like to do is to prevent the same session id from many web
browser windows. For example I would like to maintain value of product
id in session, then if user open the same page on different windows
then I would be confuse what
the right
product id for each web windows.

Basically you can't prevent it. Thankfully the web designer is not in
control of the user's browser. You cannot stop them opening the page in
a new tab or window, nor should you try. You should remember that the
user is in control, not you, and you have to design your application to
work the way the user wants. If they find it convenient to open a link
in a new window, then you have to account for that and make sure your
application will work.

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top