Page 1 of 2

Right-click

Posted: Thu Feb 19, 2004 3:35 am
by S_henry
Can we make our page can't be right-clicked? I mean if we right-click at any pages, then nothing heppen. Anybody know?

Posted: Thu Feb 19, 2004 3:49 am
by dethron

Code: Select all

<script language=JavaScript>
<!--

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4()&#123;
if (event.button==2)&#123;
alert(message);
return false;
&#125;
&#125;

function clickNS4(e)&#123;
if (document.layers||document.getElementById&&!document.all)&#123;
if (e.which==2||e.which==3)&#123;
alert(message);
return false;
&#125;
&#125;
&#125;

if (document.layers)&#123;
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
&#125;
else if (document.all&&!document.getElementById)&#123;
document.onmousedown=clickIE4;
&#125;

document.oncontextmenu=new Function("alert(message);return false")

// --> 
</script>

From http://www.dynamicdrive.com/dynamicindex9/noright.htm

Posted: Thu Feb 19, 2004 3:51 am
by dethron
And if you want to use a silent right click.

Code: Select all

<script language=JavaScript>
<!--

//Disable right click script III- By Renigade (renigade@mediaone.net)
//For full source code, visit http://www.dynamicdrive.com

var message="";
///////////////////////////////////
function clickIE() &#123;if (document.all) &#123;(message);return false;&#125;&#125;
function clickNS(e) &#123;if 
(document.layers||(document.getElementById&&!document.all)) &#123;
if (e.which==2||e.which==3) &#123;(message);return false;&#125;&#125;&#125;
if (document.layers) 
&#123;document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;&#125;
else&#123;document.onmouseup=clickNS;document.oncontextmenu=clickIE;&#125;

document.oncontextmenu=new Function("return false")
// --> 
</script>
From http://www.dynamicdrive.com/dynamicindex9/noright3.htm

Posted: Thu Feb 19, 2004 3:52 am
by microthick
This also seems to work, at least for IE.

<body oncontextmenu="return false">

Posted: Thu Feb 19, 2004 9:45 am
by John Cartwright
microthick wrote:This also seems to work, at least for IE.

<body oncontextmenu="return false">
Whatever you do, do not use that, it disables a lot more than right clicking and becomes somewhat of an annoiyance.

Posted: Thu Feb 19, 2004 11:44 am
by ol4pr0
However do not expect it to be bulletproof. anybody who wants to rip youre code can do that.. if they persistant enough...

Posted: Thu Feb 19, 2004 2:15 pm
by dethron
And of course it is.... ;)

Posted: Thu Feb 19, 2004 5:05 pm
by monkeyj
Hey personally.. I find anti-right clicking sites are annoying..
Don't do it.. o.o

I mean
If the person wants your image..
They can d/l it from the source... directly.. or w/e..
but.. Disabling right click is lame.. o.o


Just put SAMPLE over it..
but it is annoying o.o

Posted: Thu Feb 19, 2004 5:30 pm
by tim
monkeyj wrote:Hey personally.. I find anti-right clicking sites are annoying..
Don't do it.. o.o

I mean
If the person wants your image..
They can d/l it from the source... directly.. or w/e..
but.. Disabling right click is lame.. o.o


Just put SAMPLE over it..
but it is annoying o.o
Why? Right click provides no functions that a user would need to view a page or navigate... a user visiting a site dont need right click peroid unless they are up to no good, so as far as right click disabling being lame, thats just silly.

Posted: Thu Feb 19, 2004 5:31 pm
by dethron
Good point Tim....

Posted: Thu Feb 19, 2004 5:32 pm
by uberpolak
If you're trying to save an image, rather than hotlink it, right clicking makes it easier, not necessary for the job, but much easier. Plus, it's annoying if you hit the button by accident and a "Don't do that" alert box pops up.

I agree, anti-right-click nazis need to lighten up. <hippyvoice>The mouse has two buttons for a reason, man.</hippyvoice>

Posted: Thu Feb 19, 2004 5:34 pm
by dethron
Why do you want to save a picture to your HD,
they are good at where they are, just like flowers :) lol ...

Posted: Thu Feb 19, 2004 5:37 pm
by uberpolak
What I'm saying is, if you're going to use an image from elsewhere on your site (assuming of course this is kosher in a particular instance), it's much more considerate to save it for yourself, rather than use the original site's bandwidth.

Or if you have dial-up access, and you want to be able to come back to a particular picture, it's much easier than waiting for it to load all the time.

Posted: Thu Feb 19, 2004 5:39 pm
by tim
the only valid reason i see for right click is when you download a MP3 or a file, I know I personally like the Right click ->Save Target As, but could easily go without.... and if the webmaster of the page Has a page that has file downloads, then implenting the right click disable would be strange, none the less..

Right click isnt needed peroid.

Posted: Thu Feb 19, 2004 5:43 pm
by uberpolak
No, it's not needed, just makes life easier sometimes.