1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Right Click Disable how to do that ?

Discussion in 'HTML & Website Design' started by akash222, Oct 9, 2009.

  1. #1
    How to restrict visitors of mine website to do right click so that they do not copy paste mine content and cannot be able to see the source code ....

    I know there are some HTML codes but they are not working 100% its some mistakes in there HTML i think so ...

    But how can i restrict visitors of mine website to do right click for security reasons !!!! :eek:
     
    akash222, Oct 9, 2009 IP
  2. astrazone

    astrazone Member

    Messages:
    358
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #2
    add this under <body> tag.

    <script language=JavaScript>
    <!--

    //Disable right mouse click Script

    var message="Right Click is disabled!";

    ///////////////////////////////////
    function clickIE4(){
    if (event.button==2){
    alert(message);
    return false;
    }
    }
     
    astrazone, Oct 9, 2009 IP
  3. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #3
    Don't bother. Anyone can use the menu at the top of their browser to view your code.

    [​IMG]

    You'll just end up pissing people off by using JS to disable right click.

    :)
     
    Kerosene, Oct 9, 2009 IP
  4. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If it needs to be that secure, it must NOT be put on the internets.

    There are many Javascripts to disabled right-click... and many of us just don't run Javascript.

    There are some HTML and CSS tricks, like making the HTML image a transparent gif and putting the real image as the background. You can't right-click to get the image, but you only have to look up the name in the CSS file.

    You can put all your text and images in a Flash file and force all your visitors to have Flash. This means people without Flash cannot see your site at all, and this includes Google (Google can read text and accessibility tags in Flash, but you can choose not to put these in the Flash file).

    The basic answer is, any solution you hear from someone on this board can be overcome, usually very easily. Grandma doesn't want to steal your content and she'll get confused why her right-click (which often has many useful menu options in it) doesn't work, but the nerd who likes stealing content knows how to use his browser and will always get your content.

    Jamesicus might come by and post that url where some clever guy hides his content in the most complicated way. I never figured out how to get to it but most of the nerds here learned how to do it quick enough. The page is there as a proof that if it's online, it's stealable, no matter what you try.
     
    Stomme poes, Oct 9, 2009 IP
  5. jamesicus

    jamesicus Peon

    Messages:
    477
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Here you go, Stomme poes:

    This puzzle is a great challenge -- a good way to test your web authoring skills and a nice diversion from "headache" coding sessions. It also illustrates the futility of trying to hide source code If you crack it, don't post your hidden message answer here just yet -- I will do so after a short while.

    http://www.drpeterjones.com/hidden/hidden.php

    Two other ways of easily viewing source code (and copying via CTRL C):

    1. Run the page URL through a Markup Validator after specifying "show source"

    2. Or - run the page URL through the Web-Sniffer HTTP Request and Response Header Viewer -- the source code is automatically displayed.

    By way of example, Here is the output for one of my pages in Firefox 2.0

    James
     
    jamesicus, Oct 9, 2009 IP
  6. Valiant

    Valiant Peon

    Messages:
    284
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    There is no point of restricting this - don't bother!
     
    Valiant, Oct 9, 2009 IP
  7. Kerosene

    Kerosene Alpha & Omega™ Staff

    Messages:
    11,366
    Likes Received:
    575
    Best Answers:
    4
    Trophy Points:
    385
    #7
    So that's what keeps waking me up! :p
     
    Kerosene, Oct 9, 2009 IP
  8. akash222

    akash222 Peon

    Messages:
    568
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Thanks for your suggestion my dear friends
    from above suggestions its clear that we cannot if we disable right click then also user can see it from the view tab
    or he can also can use any software to copy mine content ...
    o no its not good !!!
    i want some good suggestion for mine security of mine website !!!
     
    akash222, Oct 10, 2009 IP
  9. Valiant

    Valiant Peon

    Messages:
    284
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #9
    What is your website? And what exactly do you want to protect?
     
    Valiant, Oct 10, 2009 IP
  10. Martin K

    Martin K Active Member

    Messages:
    262
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #10
    Heres a good suggestion - use PHP :)
     
    Martin K, Oct 10, 2009 IP
  11. tlcmkt

    tlcmkt Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    If you are trying to protect images, just watermark them. Dont mess with the right-click thing. If it is text, Copyscape has a program that will help. http://copyscape.com.

    tlcmkt
     
    tlcmkt, Oct 10, 2009 IP
  12. calviin

    calviin Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Put this into <head>

    <script>
    var isNS = (navigator.appName == "Netscape") ? 1 : 0;
    if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
    function mischandler(){
    return false;
    }
    function mousehandler(e){
    var myevent = (isNS) ? e : event;
    var eventbutton = (isNS) ? myevent.which : myevent.button;
    if((eventbutton==2)||(eventbutton==3)) return false;
    }
    document.oncontextmenu = mischandler;
    document.onmousedown = mousehandler;
    document.onmouseup = mousehandler;
    </script>

    Or even more simple way..
    <body oncontextmenu="return false;">
     
    calviin, Oct 10, 2009 IP
  13. mugger

    mugger Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Any site that messes with my browser or mouse, even inserts popups asking if I need chat help or if I really want to leave site, gets an automatic veto. If I must, I'll alt-f4 or reboot to escape such arogant crap. There are better ways to protect content and prevent hijacking without infuriating viewers. I am slowly adding posts about web design at my new site www.securehtmlpagesinwordpresscms.com
     
    mugger, Oct 10, 2009 IP
  14. nicelk

    nicelk Member

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #14
    To Disable right click put this code under <body> tag:

    <script language="JavaScript">
    <!--

    var message="";
    ///////////////////////////////////
    function clickIE() {if (document.all) {(message);return false;}}
    function clickNS(e) {if
    (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {(message);return false;}}}
    if (document.layers)
    {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
    else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

    document.oncontextmenu=new Function("return false")
    // -->
    </script>

    To Disable Highlight Text put this code under <body> tag.

    <script type="text/javascript">

    //form tags to omit in NS6+:
    var omitformtags=["input", "textarea", "select"]

    omitformtags=omitformtags.join("|")

    function disableselect(e){
    if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
    return false
    }

    function reEnable(){
    return true
    }

    if (typeof document.onselectstart!="undefined")
    document.onselectstart=new Function ("return false")
    else{
    document.onmousedown=disableselect
    document.onmouseup=reEnable
    }

    </script>
     
    nicelk, Oct 11, 2009 IP
  15. Chocolate Lime

    Chocolate Lime Active Member

    Messages:
    399
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #15
    By disabling the right click action on your site, you'll only alienate visitors. If a semi experienced code thief wants to extract your content, then the will use the view menu or Ctrl U in FF for example.

    Images should contain a watermark if that's what your trying to protect, or use Copyscape for textual content.

    You have to decide what it is your trying to protect.
     
    Chocolate Lime, Oct 12, 2009 IP
  16. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #16
    1. don't put it online in the first place : )

    2. make sure there's a log somewhere that can prove the time and date you put your content online. If someone else copies your text content, you can go complain to google, and use your timestamp to prove you had your content online first (or if google cached it before the theif posted their stolen copy, there's proof right there). Google is free to tell other search engines that the copy is to be ignored. The thief won't get google traffic at least.

    3. tlcmkt said watermark your images. This is a good idea, and you can also only put low-resolution versions of your images online (if you are selling artwork, the buyer gets the full-sized, hi-rez version). I can Gimp around most watermarks, depending on the image, so having smaller versions is very good.

    4. Sell your content to someone else, get your money's worth, and let the buyer worry about theives : )

    Those are my tips.

    James: thanks for posting that! : )
     
    Stomme poes, Oct 12, 2009 IP
  17. thebillkidy

    thebillkidy Peon

    Messages:
    13
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    just use an encoder and then disable it then it's solved :)
     
    thebillkidy, Oct 14, 2009 IP
  18. lowem

    lowem Member

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #18
    Come on. Any spider/bot program can just bypass all your Javascript and scrape everything.
    And I agree with mugger, I take a very dim view of sites that mess with my right to right-click.
     
    lowem, Oct 14, 2009 IP