1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum is for release discussion only. Discussions that do not relate specifically to the resource release should be discussed in another, more appropriate forum.
    Dismiss Notice
  3. 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

Discussion in 'Template Modifications [Archive]' started by borbole, Oct 11, 2010.

  1. borbole

    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:

    <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){
    return false;
    function clickNS4(e){
    if (document.layers||document.getElementById&&!document.all){
    if (e.which==2||e.which==3){
    return false;
    if (document.layers){
    else if (document.all&&!document.getElementById){
    document.oncontextmenu=new Function("alert(message);return false")
    // -->
    To change the error message that will appear to guests when right clicking at your forum, change this part:

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

    var message="Your custom message here";
    Robru, MNSPTheBOSS, sayden and 5 others like this.
  2. Miko

    Miko Well-Known Member

    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 :)
    dieketzer and Floris like this.
  3. brendanc

    brendanc Active Member

    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).
  4. Rene

    Rene New Member


    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.
    Puntocom, Onimua and Walter like this.
  5. bogus

    bogus Guest

    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?
    borbole likes this.
  6. borbole

    borbole Well-Known Member

    I am aware that it doesn''t offer full protection as stated above in my first post. But as someone told me when I added this to his forum, let us not make it easy for them :D

    But those of you who don''t see an use for it, don''t implement it then. Simple as that :)
    rainfall, Markos and (deleted member) like this.
  7. bogus

    bogus Guest

    I like it and as u wrote... It makes it a bit harder for those who even try it ;)
    borbole likes this.
  8. borbole

    borbole Well-Known Member

    They do their thing, we do our thing :D
  9. Shadab

    Shadab Well-Known Member

    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.
  10. Luke F

    Luke F Well-Known Member

    Puntocom and Onimua like this.
  11. Apokalupsis

    Apokalupsis Active Member

    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".
  12. Floris

    Floris Guest

    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" ?
  13. borbole

    borbole Well-Known Member

    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. :)
  14. Floris

    Floris Guest

    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.
  15. a legacy reborn

    a legacy reborn Well-Known Member

    There is one easy way to stop right clicking :). Block localhost!
  16. Rudy

    Rudy Well-Known Member

    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...
    Steve F likes this.
  17. Ray

    Ray Active Member

    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.
  18. Floris

    Floris Guest

    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.
  19. borbole

    borbole Well-Known Member

    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
  20. Floris

    Floris Guest

    Reality check.

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

Share This Page