Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




The JavaScript FAQ
Prev Home Next

Shift-click: Disabling

Question: Can I disable the default browser response for Shift-click event?

Answer: In Netscape Navigator 4 or Internet Explorer 4 or newer browsers, you can distinguish the Shift-click event from a simple click, and disable the default response for Shift-click. For example, Shift-click has been disabled on this page. If you use version 4 browser (or newer) under Windows, shift-click on any hyperlink on this page to test that! (In older browsers, you would still get the default response.)

To disable Shift-click, insert the following code in your page's <HEAD> section:

<script language="JavaScript">
function mouseDown(e) {
 var shiftPressed=0;
 if (parseInt(navigator.appVersion)>3) {
  if (navigator.appName=="Netscape")
  else shiftPressed=event.shiftKey;
  if (shiftPressed) {
   alert ('Shift-click is disabled.')
   return false;
 return true;
if (parseInt(navigator.appVersion)>3) {
 document.onmousedown = mouseDown;
 if (navigator.appName=="Netscape") 
<script> Copyright © 1999-2006, Alexei Kourbatov

The JavaScript FAQ
Prev Home Next

  Mirrored with kind permission of Alexei Kourbatov Design by Interspire