| Author |
Topic Search Topic Options
|
Eagle
Newbie
Joined: 09 November 2003
Location: Canada
Status: Offline
Points: 6
|
Post Options
Thanks(0)
Quote Reply
Topic: Mouse right side button Posted: 12 April 2004 at 4:10pm |
|
Could anyone tell me if there is a code to prevent someone of using his mouse right side button on a specific web page?
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 5:00pm |
There is no code in the world that would ever prevent someone from pressing the right mouse button +click+ BUT you can prevent someone from gettin an applications (i.e. IE) context menu when they press the right button. Something like the following sure is not fool proof but should prevent the majority of your users to get a context menu: (you don't have to give the a message box, you can take that out so nothing happens when they right click)
<script language="JavaScript"> <!-- var message="Ouch!";
function click(e) { if (document.all) { if (event.button == 2) { alert(message); return false; } } if (document.layers) { if (e.which == 3) { alert(message); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; // --> </script>
|
|
|
|
 |
BoLt
Senior Member
Joined: 20 November 2003
Location: United Kingdom
Status: Offline
Points: 285
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 5:03pm |
Copy this Java Script into the head of the html
Hope this helps
<SCRIPT LANGUAGE="JAVASCRIPT"> <!-- Begin var message="Sorry but I can not let you copy or save!!";
function click(e) { if (document.all) { if (event.button == 2) { alert(message); return false; } } if (document.layers) { if (e.which == 3) { alert(message); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; // End --> </SCRIPT>
|
|
BoLt (Computer Engineer)
I suffer from Dyslexia, it means I can not spell to well not that I am thick.
www.welshlens.co.uk
|
 |
Eagle
Newbie
Joined: 09 November 2003
Location: Canada
Status: Offline
Points: 6
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 5:13pm |
Thank you very much for your help.
This should do the work just fine.
|
 |
dpyers
Senior Member
Joined: 12 May 2003
Status: Offline
Points: 3937
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 5:20pm |
|
Just out of curiousity, why would you want to prevent a user from using a feature they're used to?
|
Lead me not into temptation... I know the short cut, follow me.
|
 |
Licttum
Newbie
Joined: 02 September 2003
Location: Australia
Status: Offline
Points: 24
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 6:25pm |
yeh i would have to say that any site that prevents me from right clicking, I am not going to stay on it for long...
i have dual monitors and like to right click and "open link in new window".
|
 |
Eagle
Newbie
Joined: 09 November 2003
Location: Canada
Status: Offline
Points: 6
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 9:38pm |
dpyers wrote:
Just out of curiousity, why would you want to prevent a user from using a feature they're used to? |
Well in fact, it is not for my own site. It's for my wife’s personal site. She didn't want the people to be able to cut and paste her family pictures that she put on her site. As for myself, I would rather let the people use this feature, but if that what she wants.
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
Posted: 12 April 2004 at 10:17pm |
|
If someone wants the picture really bad there is not so much you can do about it and if it is to make a screenshot and crop it out. There has been a lengthy thread about it some time ago, though to sum up, if someone wants your wifes picture as their desktop bg there is not much you can do about it unless taking the pics offline.
|
|
|
 |