473,396 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Disabling shift click

I want to disable right click in my application.Here are my requirements.

1. I don't what to turn off shift click for the page. I want to turn it off for specific links.
2. I want shift-click to be replaced with a regular click. Meaning, when the user shift-clicks the link they will be taken to the "HREF" within the current browser window and NOT open up a new window.

I did find a script that does something close to what I want, but it fails to meet all of the criteria above... I'll list it below so someone doesn't waste their time providing it as a solution....

Expand|Select|Wrap|Line Numbers
  1. function mouseDown(e) 
  2. {
  3. var shiftPressed=0;
  4. if (parseInt(navigator.appVersion)>3) 
  5. {
  6. if (navigator.appName=="Netscape")
  7. shiftPressed=(e.modifiers-0>3);
  8. else 
  9. shiftPressed=event.shiftKey;
  10.  
  11. if (shiftPressed) 
  12. {
  13. alert ('Shift-click is disabled.')
  14. return false;
  15. }
  16. }
  17.  
  18. return true;
  19. }
  20.  
  21. if (parseInt(navigator.appVersion)>3) 
  22. {
  23. document.onmousedown = mouseDown;
  24.  
  25. if (navigator.appName=="Netscape") 
  26. document.captureEvents(Event.MOUSEDOWN);
  27. }
  28.  
  29.  
Thanks in advance
Feb 8 '06 #1
3 5462
I want to disable right click in my application.Here are my requirements.

1. I don't what to turn off shift click for the page. I want to turn it off for specific links.
2. I want shift-click to be replaced with a regular click. Meaning, when the user shift-clicks the link they will be taken to the "HREF" within the current browser window and NOT open up a new window.

I did find a script that does something close to what I want, but it fails to meet all of the criteria above... I'll list it below so someone doesn't waste their time providing it as a solution....

Expand|Select|Wrap|Line Numbers
  1. function mouseDown(e) 
  2. {
  3. var shiftPressed=0;
  4. if (parseInt(navigator.appVersion)>3) 
  5. {
  6. if (navigator.appName=="Netscape")
  7. shiftPressed=(e.modifiers-0>3);
  8. else 
  9. shiftPressed=event.shiftKey;
  10.  
  11. if (shiftPressed) 
  12. {
  13. alert ('Shift-click is disabled.')
  14. return false;
  15. }
  16. }
  17.  
  18. return true;
  19. }
  20.  
  21. if (parseInt(navigator.appVersion)>3) 
  22. {
  23. document.onmousedown = mouseDown;
  24.  
  25. if (navigator.appName=="Netscape") 
  26. document.captureEvents(Event.MOUSEDOWN);
  27. }
Thanks in advance
Feb 8 '06 #2
ronverdonk
4,258 Expert 4TB
Be sure that there is NO way you can hide your page from someone who is set on knowing what it is! You can only do that for the casual visitor.

Since the HTML stuff (and included Javascript) is client-side at thus running on his/her PC, he/she can always get to it.
You can try to make it very difficult, but there is no preventing a determined user from getting at client-side code. What you can do is use as much server-side code as possible.

Ronald :cool:
Jul 20 '06 #3
iam_clint
1,208 Expert 1GB
I do not believe are you are going to beable to do what your trying..

Shift click is a built in function in IE and other Browsers.. If i figure anything out on it though i will post but i highly doubt its going to work.
Aug 1 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

20
by: dukeleto | last post by:
I know this is an annoying thing on some sites. I have set some images in an online gallery to have their own java po up window that is set to be the same size as the image. I would like to...
7
by: Paul Cooper | last post by:
Dear All, I am working on a piece of Javascript code that needs to detect a mouse-click, shift-click and control-click. The code is not my own - it is a part of a much larger suite of routines....
1
by: Ghulam | last post by:
I am using an Access 2k ADP (Converted into ADE) front end and SQL 2K on the backend. Although I taught pretty much myself into these concept with the help of some publications and users group...
1
by: David Hearn | last post by:
I have a javascript function that is fired on the KeyDown event of a textbox. I am adding the attribute to the textbox at page load to run this javascript function. The javascript runs as expected...
7
by: Robert | last post by:
Can I programmatically disable the right click context menu?
5
by: Joja | last post by:
I have form with one submit button. All i want to create is to allow user to make JUST ONE button click. After that click, button will be still displayed but it will be disabled. How to make this ?
12
Subsciber123
by: Subsciber123 | last post by:
I have a window that I have created using Python Card that contains an wx.iehtmlWindow opject inside of it. Does anyone know how to disable right click and/or cause links that would open in new...
15
by: Dan2kx | last post by:
Hello peeps!! got another problem that is outta my league.... What i want (and can do) is to disable the DB window on startup, (what i cant do) disable the shift key load... Also i need...
3
by: zandiT | last post by:
hello i have a database that ive converted to an mde because its going on the network and will be accessd by various users. on the startup option i unticked all the options available so users...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.