• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Disable right click for guests on your forum

borbole

Well-known member
This script taken from dynamic drive will disable the right click on your forum for guests. As to offer some protection to your materials being stolen from your forum.

Note: This will prevent them only for the right click and copy/paste directly.

Anyway, at the page_container_js_head template, after or before all the code in there, add the following code:

Code:
<xen:if is="!{$visitor.user_id}">
<script type="text/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="Right click is disabled for guests!";

///////////////////////////////////
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>
</xen:if>

To change the error message that will appear to guests when right clicking at your forum, change this part:

Code:
var message="Right click is disabled for guests!";

to:

Code:
var message="Your custom message here";
 
Are you aware that those scripts are 100% useless?
Anyone can view the source of your website by simply using the view source menu or shortcut that is included in most if not all browsers.

Other than that, congratulation :)
 
I agree with Miko. Besides, anyone who really wants to steal something from your forum will know how to disable javascript anyway.

Plus, a lot of people use NoScript so it might not work anyway (since they might not notice the difference between js being on/off -- a side effect of XF's really good graceful degradation).
 
@borbole

I wouldn't suggest to restrict user's experience by disabling the famous right click. People react often picky about that one and, as brendanc made clear, everyone with a little brains can bypass your protection very easily.
 
Its a good prevention at all. BTW i also use this within the right click

btw. What do i have to enter if i want to use this modification for everybody?
 
Pretty much agree with what Miko, brendanc & Rene have already said. It doesn't offer any protection whatsoever. Those users who are determined to copy & steal your content will do so anyway. No amount of JavaScript tricks and html source obfuscation will deter them. What it does is degrade the browsing experience of your average forum visitor by disabling an important mouse function. It only adds to the owner's false sense of security that the forum content will not be copied.

Not being rude to Borbole in any way. :) Just expressing my displeasure at the usage of many such scripts (in general, not just this particular script) which serve no purpose other than giving an illusion of security & protection to those uninformed.
 
0941.jpg
 
I concur. I appreciate the effort to provide custom mods to the XF community. But this specific mod is extremely easy to get around by the average user IMO. In FF, just disable javascript, copy/paste, then re-enable. Of course, there are plenty of anti-script addons for FF, but simply turning off JS is the easiest way to skirt the "protection".
 
So you don't allow someone to right click on a page to use accessibility features such as screen reader or braille convert, etc. Or spelling corrections when typing, or to let them jump things into a new window or a new tab?

Completely useless tweak, people (friends included) should not expect me to register and post or even visit sites that use this.

Sorry for the bluntness, but what's next, remapping keyboard keys so people can't use "print screen" ?
 
So you don't allow someone to right click on a page to use accessibility features such as screen reader or braille convert, etc. Or spelling corrections when typing, or to let them jump things into a new window or a new tab?

Completely useless tweak, people (friends included) should not expect me to register and post or even visit sites that use this.

Sorry for the bluntness, but what's next, remapping keyboard keys so people can't use "print screen" ?

No need to be sorry for the bluntness. You and everyone else are entitled to your own opinions. But you should know that what is useless to you, it might be useful to someone else and vice-versa. :)
 
No, what I said was a fact as well .. you can protect all you want, but the reality is that you can't protect it .. I can go to your site and take a picture of it. Clean it up with surface blur in Photoshop and repost it.

Your opinion is wishful thinking, you can't protect it. And that's blunt from me to say, but it's a fact.

Engage your audience, don't push them away.
 
So you don't allow someone to right click on a page to use accessibility features such as screen reader or braille convert, etc. Or spelling corrections when typing, or to let them jump things into a new window or a new tab?

Completely useless tweak, people (friends included) should not expect me to register and post or even visit sites that use this.

I click away from sites that use this. I am very much a user of the right-click context menu. Here in Chrome I can go back a page or reload the current page with a right click. Take that away, and I'll visit another site. This type of JS code was all the rage a few years ago, but since everyone figured out how to get around it, it has pretty much fallen by the wayside. Plus, I think if Google spiders your images, visitors can copy from Google instead.

There is a way to protect images from right-click theft (my one client actually had a rampant problem with competitors stealing dozens upon dozens of her catalog product images), but it does not involve disabling right-click at all...
 
This offers little protection, but it would be better to disable "highlighting" of text, many sites use this, mainly lyrics sites.
The average user doesn't know how to view the source, so IMO, it would work.
 
This offers little protection, but it would be better to disable "highlighting" of text, many sites use this, mainly lyrics sites.
The average user doesn't know how to view the source, so IMO, it would work.
Yeah, and those users ask people like me and other 'techy guys' how to get it, we laugh, disable js, and right click and give them what they are looking for.. Or just tell them to take the screenshot.
 
No, what I said was a fact as well .. you can protect all you want, but the reality is that you can't protect it .. I can go to your site and take a picture of it. Clean it up with surface blur in Photoshop and repost it.

Your opinion is wishful thinking, you can't protect it. And that's blunt from me to say, but it's a fact.

Engage your audience, don't push them away.

Floris, that is true, that does not protect it as I was clear about it in my first post here. But that does not mean that we have to make it easy for those that try to steal the contents. This will make them work harder if you will :D
 
Reality check.

People that steal your content don't do it via right clicking .. It's not 1995.
 
Top Bottom