What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Disabling Right Clicking in Html?

Pages: (4): « First [ 1 ] 2 3 4 » Last »
Disabling Right Clicking in Html?
Author: Message:
M73A
Veteran Member
*****

Avatar


Posts: 3213
Reputation: 37
34 / Male / Flag
Joined: Jul 2004
O.P. Disabling Right Clicking in Html?
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...

[Image: lost7ru.gif]
04-03-2005 07:17 PM
Profile E-Mail PM Find Quote Report
Jhrono
Veteran Member
*****


Posts: 1791
Reputation: 25
32 / Male / Flag
Joined: Jun 2004
RE: Disabling Right Clicking in Html?
i think(I DONT KNOW) it is worked out with a java script thingie isnt it?
04-03-2005 07:21 PM
Profile E-Mail PM Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
37 / Male / Flag
Joined: Jul 2003
RE: Disabling Right Clicking in Html?
in the body tag put
code:
oncontextmenu="return false"
or something
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
04-03-2005 07:23 PM
Profile E-Mail PM Web Find Quote Report
Anubis
Elite Member
*****

Avatar
42

Posts: 2695
Reputation: 64
33 / Male / Flag
Joined: Oct 2003
RE: Disabling Right Clicking in Html?
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>

This post was edited on 04-03-2005 at 07:27 PM by Anubis.
[Image: anubis5hq.png]
04-03-2005 07:26 PM
Profile PM Find Quote Report
M73A
Veteran Member
*****

Avatar


Posts: 3213
Reputation: 37
34 / Male / Flag
Joined: Jul 2004
O.P. RE: Disabling Right Clicking in Html?
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:)

[Image: lost7ru.gif]
04-03-2005 07:33 PM
Profile E-Mail PM Find Quote Report
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
RE: Disabling Right Clicking in Html?
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.
04-03-2005 07:35 PM
Profile PM Web Find Quote Report
M73A
Veteran Member
*****

Avatar


Posts: 3213
Reputation: 37
34 / Male / Flag
Joined: Jul 2004
O.P. RE: Disabling Right Clicking in Html?
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:)

[Image: lost7ru.gif]
04-03-2005 07:37 PM
Profile E-Mail PM Find Quote Report
toddy
Veteran Member
*****

Avatar
kcus uoy

Posts: 2573
Reputation: 49
– / Male / Flag
Joined: Jun 2004
RE: Disabling Right Clicking in Html?
why do u want to disbale right click anyway ??? its just plain annoyin when u can't :dodgy:
04-03-2005 07:37 PM
Profile PM Find Quote Report
M73A
Veteran Member
*****

Avatar


Posts: 3213
Reputation: 37
34 / Male / Flag
Joined: Jul 2004
O.P. RE: Disabling Right Clicking in Html?
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:

[Image: lost7ru.gif]
04-03-2005 07:44 PM
Profile E-Mail PM Find Quote Report
Dempsey
Scripting Contest Winner
*****

Avatar
http://AdamDempsey.net

Posts: 2395
Reputation: 53
37 / Male / Flag
Joined: Jul 2003
RE: Disabling Right Clicking in Html?
btw it is possible using just html, you use the following code in the body tag
code:
oncontextmenu="return false"
SoundPacks   -   Scripts   -   Skins

that's not a bug, thats an unexpected feature
04-03-2005 07:48 PM
Profile E-Mail PM Web Find Quote Report
Pages: (4): « First [ 1 ] 2 3 4 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On