Shoutbox

Disabling Right Clicking in Html? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Disabling Right Clicking in Html? (/showthread.php?tid=41863)

Disabling Right Clicking in Html? by M73A on 04-03-2005 at 07:17 PM

hi, i would like to know how easy it is to disable the right click menu on a website.....is it possible to do it in html. or will it have to be another format like php?

thanks...


RE: Disabling Right Clicking in Html? by Jhrono on 04-03-2005 at 07:21 PM

i think(I DONT KNOW) it is worked out with a java script thingie isnt it?


RE: Disabling Right Clicking in Html? by Dempsey on 04-03-2005 at 07:23 PM

in the body tag put

code:
oncontextmenu="return false"
or something
RE: Disabling Right Clicking in Html? by Anubis on 04-03-2005 at 07:26 PM

It is not possible in pure HTML, but you will need to use JavaScript
Just paste that into the <BODY> tag. btw, disableing right clicking is not a fool proof way to stop people stealing your websites sources. It will only stop pople who are very limited computer users in general.

code:
<script language=JavaScript>
var message="Function Disabled!";

///////////////////////////////////

function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

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

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
</script>

RE: Disabling Right Clicking in Html? by M73A on 04-03-2005 at 07:33 PM

quote:
Originally posted by Anubis
It is not possible in pure HTML, but you will need to use JavaScript
Just paste that into the <BODY> tag. btw, disableing right clicking is not a fool proof way to stop people stealing your websites sources. It will only stop pople who are very limited computer users in general.

code:
<script language=JavaScript>
var message="Function Disabled!";

///////////////////////////////////

function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

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

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
</script>


thanks anubis. so just copy that into the html code yeah? i dont really use javascript...is it external like .css? or do i place that code in the html? thanks:)

RE: Disabling Right Clicking in Html? by .Roy on 04-03-2005 at 07:35 PM

quote:
Originally posted by may73alliance
quote:
Originally posted by Anubis
It is not possible in pure HTML, but you will need to use JavaScript
Just paste that into the <BODY> tag. btw, disableing right clicking is not a fool proof way to stop people stealing your websites sources. It will only stop pople who are very limited computer users in general.

code:
<script language=JavaScript>
var message="Function Disabled!";

///////////////////////////////////

function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

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

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
</script>


thanks anubis. so just copy that into the html code yeah? i dont really use javascript...is it external like .css? or do i place that code in the html? thanks:)

you go to the html file in ur site.

now u look for <body> and under body u just paste all of that. Its that easy.

RE: Disabling Right Clicking in Html? by M73A on 04-03-2005 at 07:37 PM

quote:
Originally posted by Hobbes


you go to the html file in ur site.

now u look for <body> and under body u just paste all of that. Its that easy.

lol, oh right:) thanks guys:)
RE: Disabling Right Clicking in Html? by toddy on 04-03-2005 at 07:37 PM

why do u want to disbale right click anyway ??? its just plain annoyin when u can't :dodgy:


RE: Disabling Right Clicking in Html? by M73A on 04-03-2005 at 07:44 PM

quote:
Originally posted by toddler
why do u want to disbale right click anyway ??? its just plain annoyin when u can't :dodgy:

because the people who will look at the html wont need to right click....so im not gonna let em :tongue:

RE: Disabling Right Clicking in Html? by Dempsey on 04-03-2005 at 07:48 PM

btw it is possible using just html, you use the following code in the body tag

code:
oncontextmenu="return false"

RE: Disabling Right Clicking in Html? by M73A on 04-03-2005 at 07:57 PM

quote:
Originally posted by Dempsey
btw it is possible using just html, you use the following code in the body tag
code:
oncontextmenu="return false"


when i do that i just get the words 'oncontextmenu="return false"' show up in the background of the webage.

the javascript works:).

is there a way to get it to work in firefox? the message saying function disabled appears but the right click menu just appers once u click 'OK', lol


theres

quote:
Originally posted by code

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


which id say is netscape? and theres another for IE AFAIK...whats the code for mozilla firefox? :)
RE: Disabling Right Clicking in Html? by Dempsey on 04-03-2005 at 08:12 PM

did you do it like

code:
<body oncontextmenu="return false">
or
code:
<body>oncontextmenu="return false"
It sounds like you did it the second way, but it should be the first, in the body tag
RE: Disabling Right Clicking in Html? by Anubis on 04-03-2005 at 08:15 PM

quote:
Originally posted by may73alliance


which id say is netscape? and theres another for IE AFAIK...whats the code for mozilla firefox?
The code I gave you works in Mozilla Firefox, most likely because it uses the Netscape engine...but I haven't found a browser that code didn't support.
RE: Disabling Right Clicking in Html? by Ezra on 04-03-2005 at 08:26 PM

That code really has no use:P, If you keep the right mouse button pressed and press ok, it still shows the menu, and the same buttons are also in the View button next to Edit :P


RE: RE: Disabling Right Clicking in Html? by Anubis on 04-03-2005 at 08:32 PM

quote:
Originally posted by Ezra
That code really has no use:P, If you keep the right mouse button pressed and press ok, it still shows the menu, and the same buttons are also in the View button next to Edit :P

It's the same with all disable right click scripts, you can just drag the image to the URL bar and copy it...Anti right clicking is really a dumb idea, tbh.
RE: Disabling Right Clicking in Html? by M73A on 04-03-2005 at 08:34 PM

quote:
Originally posted by Dempsey
did you do it like
code:
<body oncontextmenu="return false">
or
code:
<body>oncontextmenu="return false"
It sounds like you did it the second way, but it should be the first, in the body tag

yeah i was using the second one :tongue:

quote:
Originally posted by Anubis
quote:
Originally posted by may73alliance


which id say is netscape? and theres another for IE AFAIK...whats the code for mozilla firefox?
The code I gave you works in Mozilla Firefox, most likely because it uses the Netscape engine...but I haven't found a browser that code didn't support.

oh right, just when i previewed the html in firefox i could right click my heart away, lol
RE: Disabling Right Clicking in Html? by albert on 04-03-2005 at 09:07 PM

there's a code in javascript : http://www.funkychickens.com


should work out ;-)


RE: Disabling Right Clicking in Html? by lizard.boy on 04-03-2005 at 09:46 PM

bah i hate codes like that.. especially in sites like mess. because the way mess does it you cant center clikc to scroll :/ but then again mess is just fucked with the use of javascript and frames.


RE: Disabling Right Clicking in Html? by linx05 on 04-04-2005 at 09:20 AM

Meh. I just use the plugin in Maxthon and it disables all forms of the "disable right click" feature.


RE: Disabling Right Clicking in Html? by Pipish on 04-04-2005 at 09:26 AM

why would you want to disable it , it makes people feel like they have a mac :P unless your protecting something :?


RE: Disabling Right Clicking in Html? by TheGeek on 04-04-2005 at 01:11 PM

quote:
Originally posted by may73alliance
hi, i would like to know how easy it is to disable the right click menu on a website.....is it possible to do it in html. or will it have to be another format like php?

thanks...

I really advise you NOT to disable it. Its really annoying and it can be disabled really quickly. If someone wants to steal something from your site and you disable the rightclicking, he/she will probably look at the source code. Even if the source is encrypted, its easy to decode it again.
RE: Disabling Right Clicking in Html? by .Roy on 04-05-2005 at 06:03 AM

heres one i found.

<Script Language="JavaScript">
<!--
document.oncontextmenu = function(){return false}
if(document.layers) {
    window.captureEvents(Event.MOUSEDOWN);
    window.onmousedown = function(e)
    {if(e.target==document)return false;}}
else {document.onmousedown = function(){return false}
}
-->
</Script>


RE: Disabling Right Clicking in Html? by Purity on 04-05-2005 at 06:05 AM

If you are trying to stop people from stealing images with right clicking it wont make a difference...Just print screen and crop out the crap around the pic....


RE: Disabling Right Clicking in Html? by .Roy on 04-05-2005 at 06:08 AM

or you can look at the source code. But most noobs wouldnt know that :P


RE: RE: Disabling Right Clicking in Html? by TheGeek on 04-05-2005 at 12:03 PM

quote:
Originally posted by Hobbes
or you can look at the source code. But most noobs wouldnt know that :P

Guess again, most noobs try that when rightclicking fails
RE: Disabling Right Clicking in Html? by Concord Dawn on 04-05-2005 at 12:23 PM

Heh, even better is when you can just click and drag the image from the website and hit (Windows Key)+D and then just drag the picture onto your desktop. Easiest way around disabling right click that I know of.


RE: Disabling Right Clicking in Html? by -dt- on 04-05-2005 at 12:25 PM

=/ anti right clicking is really bad and can be disabled easily eg
if you disable javascript (very easy)
run a javascript bookmark to disable your protection
run greasemonkey to make the javascript auto disable your protection.
if someone wants the source to your page they will get it , if you dotn want someone having your source don't put your website on the net.


RE: Disabling Right Clicking in Html? by TheGeek on 04-05-2005 at 03:41 PM

Or use flash ;)


RE: Disabling Right Clicking in Html? by segosa on 04-06-2005 at 06:38 AM

quote:
Originally posted by TheGeek
Or use flash ;)

And let others decompile it?
RE: Disabling Right Clicking in Html? by ipab on 04-06-2005 at 06:50 AM

quote:
Originally posted by Segosa

And let others decompile it?

lol good point

as for disabling right clicking, i feel that it gives people more incentive into bypassing it rather than when it arose less supiscion when it wasnt blocked
RE: Disabling Right Clicking in Html? by saralk on 04-18-2006 at 01:09 PM

to stop the average joe from looking at your source code, this might be quite useful...

http://www.dynamicdrive.com/dynamicindex9/encrypter.htm


RE: Disabling Right Clicking in Html? by hmaster on 04-18-2006 at 03:03 PM

Firefox, Ctrl + U, view the source and links to any images. :D


RE: RE: Disabling Right Clicking in Html? by rav0 on 04-18-2006 at 11:46 PM

quote:
Originally posted by saralk
to stop the average joe from looking at your source code, this might be quite useful...

http://www.dynamicdrive.com/dynamicindex9/encrypter.htm

It barely works. Everything is still readable, and it's even easier to deocde.
RE: Disabling Right Clicking in Html? by Supersonicdarky on 04-18-2006 at 11:55 PM

i don't see a reason to revive such an old thread... :undecided:


RE: RE: Disabling Right Clicking in Html? by rav0 on 04-19-2006 at 12:00 AM

quote:
Originally posted by Supersonicdarky
i don't see a reason to revive such an old thread... :undecided:

Let the people revive their threads ...

Besides, if there's discussion to be had, discuss!
RE: RE: RE: Disabling Right Clicking in Html? by Supersonicdarky on 04-19-2006 at 12:02 AM

quote:
Originally posted by rav0
quote:
Originally posted by Supersonicdarky
i don't see a reason to revive such an old thread... :undecided:

Let the people revive their threads ...

Besides, if there's discussion to be had, discuss!

fine i will, just that when i revived a thread when i just joined i got 5 negatives :P

as already said, it is easy to read if u know that %20 stands for a space and other chars
RE: Disabling Right Clicking in Html? by rav0 on 04-19-2006 at 12:06 AM

yeah, but most of the time the only encoded characters will be spaces, and the occasional apostrophe, which you can delete and still be able to read the word.