The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How to disable right click

View previous topic View next topic Go down

In progress How to disable right click

Post by Hellrose on July 10th 2011, 4:18 am

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

Back to top Go down

In progress Re: How to disable right click

Post by KingOfSports on July 10th 2011, 4:31 am

They can still copy it by using the source code or by clicking the image and posting it as the URL.

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

Male Posts : 2487
Reputation : 38
Language :
Location :

Back to top Go down

In progress Re: How to disable right click

Post by Base on July 10th 2011, 11:04 am

You could also try adding this code:

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. Wink

Base
Forumaster

Male Posts : 10386
Reputation : 1687
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

In progress Re: How to disable right click

Post by msedgley on July 27th 2011, 1:07 pm

does this get posted in the home message

msedgley
Forumember

Female Posts : 618
Reputation : 34
Language : English
Location : UK

http://www.rateoffire.com

Back to top Go down

In progress Re: How to disable right click

Post by Base on July 27th 2011, 5:51 pm

Either that, a widget or I think it can now be posted as a Javascript code in the administration panel as well. Wink

Base
Forumaster

Male Posts : 10386
Reputation : 1687
Language : English and French
Location : United Kingdom, England

http://forumotionhub.net

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum