File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Disabling the links in a document on holding the Shift Key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disabling the links in a document on holding the Shift Key" Watch "Disabling the links in a document on holding the Shift Key" New topic

Disabling the links in a document on holding the Shift Key

Vishal Gandhi

Joined: Jan 18, 2006
Posts: 3
I need to disable the links in a document whenever the Shift key is pressed. But once the Shift Key is released, the links have to be enabled again. This i because, i wish to avoid the Ctrl-N problem and on clicking on any link while holding the Shift key, the problem resurfaces with a new window sharing the same session getting popped up.
Also, any thing apart from <links, left arrow and right arrow key> has to be enabled. I got some script but because of that the radio button was allowing to be not selected at all.
Please provide me your inputs for this problem asap.
Solutions specific to IE will also suffice.
[ January 19, 2006: Message edited by: Bear Bibeault ]
Himanshu Bisht
Ranch Hand

Joined: Aug 27, 2004
Posts: 96
Well disabling all links on shift press is not a bright idea.I can think of two solutions

1) Hide mouse pointer on shift press.I think it is possible in javascript.

2) Second, try to write all hyperlinks using javascript i.e. fwd all request through javascript.Javascript doesn't allow "Shift+Click" to open a new window so this could also be a solution to your problem.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You can not hide the mouse!

This will not work if the person disables JavaScript, have a browser that does not allow right click to be disabled, and many others.

If you are having problems with multile sessions or such, then you really need to attack this at the server level.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62513

Point #1: Eric is right -- applying band-aids will get you nowhere. Solve the real problem.

Point #2: Please read this to see why putting URGENT in your titles and posts is not a good idea. I have removed it from your subject title for you.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tiku Popat

Joined: Jan 11, 2006
Posts: 3
I also need answer to this problem. Does anyone know how to disable the new browser that opens when one hits Shift and click on the link.
I agree. Here's the link:
subject: Disabling the links in a document on holding the Shift Key