How to disable right click
4 posters
Page 1 of 1
How to disable right click
How to disable right click? so no one can copy the image link of my pictures in my forum?
Hellrose- Forumember
- Posts : 202
Reputation : 0
Language : English
Re: How to disable right click
They can still copy it by using the source code or by clicking the image and posting it as the URL.
This will give you a popup message:
- Code:
<body oncontextmenu="return false"</body>
This will give you a popup message:
- Code:
function Plan() {
alert('Your Text Here');
return(false);
}
document.oncontextmenu = iPlan;
KingOfSports- Hyperactive
- Posts : 2487
Reputation : 38
Language :
Location :
Re: How to disable right click
You could also try adding this code:
That will disable right click on all images. Credits to Dynamic Drive.
- Code:
<script language="JavaScript1.2">
/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/
var clickmessage="Right click disabled on images!"
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
else if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
else if (document.getElementById){
if (e.which==3&&e.target.tagName=="IMG"){
alert(clickmessage)
return false
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.getElementById)
document.onmouseup=disableclick
else if (document.layers)
associateimages()
</script>
That will disable right click on all images. Credits to Dynamic Drive.
Re: How to disable right click
Either that, a widget or I think it can now be posted as a Javascript code in the administration panel as well.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum