Where do I add the "right-click-disable" code?

22 replies
  • WEB DESIGN
  • |
Hi all,

I have a right-click-disable code that I installed before the <head> tag in Wordpress and then tried adding it after the </head> but it won't work.

The script I added is:

<script type="text/javascript">
<!--
// Disabling context menu and copy
$(document).ready(function () {
$('body').bind('contextmenu copy', function (e) {
alert('All material on this site is copyright protected. Thank you for honoring our terms and conditions. We encourage you to share our URL or use the social networking buttons made available on every page.');
e.preventDefault();
});
});
// -->
</script>

Would appreciate your suggestions.
#add #code #rightclickdisable
  • Profile picture of the author Alex Blades
    Put in inside the head tag, toward the bottom away from your other codes.
    Signature
    " I knew that if I failed, I wouldn't regret that.
    But I knew the one thing I might regret is not ever having tried. "

    ~ Jeff Bezos

    {{ DiscussionBoard.errors[8188060].message }}
  • {{ DiscussionBoard.errors[8188247].message }}
  • Profile picture of the author Social App Zone
    Does Wordpress bot not have a better image protection plug-in? Disabling the Right Click button is a little medieval.

    The right click button provides other options such as printing, translation, reload, going back.
    {{ DiscussionBoard.errors[8188486].message }}
  • Profile picture of the author Alex Blades
    Does Wordpress bot not have a better image protection plug-in? Disabling the Right Click button is a little medieval.
    They may, I'm not sure. Placing the code is better IMO, since the less plugins you use, the better the load time.
    Signature
    " I knew that if I failed, I wouldn't regret that.
    But I knew the one thing I might regret is not ever having tried. "

    ~ Jeff Bezos

    {{ DiscussionBoard.errors[8188547].message }}
  • Profile picture of the author Social App Zone
    Here is the correct code. It uses Jquery.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script type="text/javascript">
    <!--
    // Disabling context menu and copy
    $(document).ready(function () {
    $('body').bind('contextmenu copy', function (e) {
    alert('All material on this site is copyright protected. Thank you for honoring our terms and conditions. We encourage you to share our URL or use the social networking buttons made available on every page.');
    e.preventDefault();
    });
    });
    // -->
    </script>

    See working demo here --> http://www.lolyee.net/log-with-lips.php
    {{ DiscussionBoard.errors[8188573].message }}
    • Profile picture of the author WillR
      Originally Posted by Social App Zone View Post

      Here is the correct code. It uses Jquery.

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
      <script type="text/javascript">
      <!--
      // Disabling context menu and copy
      $(document).ready(function () {
      $('body').bind('contextmenu copy', function (e) {
      alert('All material on this site is copyright protected. Thank you for honoring our terms and conditions. We encourage you to share our URL or use the social networking buttons made available on every page.');
      e.preventDefault();
      });
      });
      // -->
      </script>

      See working demo here --> http://www.lolyee.net/log-with-lips.php
      I save your page to my desktop.

      I remove the script from above.

      I now have all your content.

      My point is this type of things doesn't stop anything really. The people who really want to copy your content will still do so.

      Just the nature of the beast.
      {{ DiscussionBoard.errors[8188858].message }}
      • Profile picture of the author Social App Zone
        Originally Posted by WillR View Post

        I save your page to my desktop.

        I remove the script from above.

        I now have all your content.

        My point is this type of things doesn't stop anything really. The people who really want to copy your content will still do so.

        Just the nature of the beast.
        The main problem I have with this solution is it messing with the usability of the browser. I would suggest accept that your content can be ultimately copied and do something like this:

        <script type="text/javascript">
        function addLink() {
        var body_element = document.getElementsByTagName('body')[0];
        var selection;
        selection = window.getSelection();
        var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.locat ion.href+"</a><br />Copyright &copy; LOLYEE.net"; // change this if you want
        var copytext = selection + pagelink;
        var newdiv = document.createElement('div');
        newdiv.style.position='absolute';
        newdiv.style.left='-99999px';
        body_element.appendChild(newdiv);
        newdiv.innerHTML = copytext;
        selection.selectAllChildren(newdiv);
        window.setTimeout(function() {
        body_element.removeChild(newdiv);
        },0);
        }
        document.oncopy = addLink;
        </script>

        Basically it will append the original location of the content and some (c) when you copy.

        You can see it running in this example:

        http://www.lolyee.net/acopy.php

        When you copy the text

        "
        One One was a race horse. Two Two was one too. One One won one race and Two Two won one too.
        "

        It will paste as

        "One One was a race horse. Two Two was one too. One One won one race and Two Two won one too.

        Read more at: http://www.lolyee.net/acopy.php
        Copyright © LOLYEE.net"
        {{ DiscussionBoard.errors[8188934].message }}
        • Profile picture of the author Core Freedom
          Originally Posted by Social App Zone View Post

          The main problem I have with this solution is it messing with the usability of the browser. I would suggest accept that your content can be ultimately copied and do something like this:

          <script type="text/javascript">
          function addLink() {
          var body_element = document.getElementsByTagName('body')[0];
          var selection;
          selection = window.getSelection();
          var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.locat ion.href+"</a><br />Copyright &copy; LOLYEE.net"; // change this if you want
          var copytext = selection + pagelink;
          var newdiv = document.createElement('div');
          newdiv.style.position='absolute';
          newdiv.style.left='-99999px';
          body_element.appendChild(newdiv);
          newdiv.innerHTML = copytext;
          selection.selectAllChildren(newdiv);
          window.setTimeout(function() {
          body_element.removeChild(newdiv);
          },0);
          }
          document.oncopy = addLink;
          </script>

          Basically it will append the original location of the content and some (c) when you copy.

          You can see it running in this example:

          http://www.lolyee.net/acopy.php

          When you copy the text

          "
          One One was a race horse. Two Two was one too. One One won one race and Two Two won one too.
          "

          It will paste as

          "One One was a race horse. Two Two was one too. One One won one race and Two Two won one too.

          Read more at: http://www.lolyee.net/acopy.php
          Copyright © LOLYEE.net"
          That's actually what Tynt does. It places not only a backlink but it places all the other stuff too. The challenge I have is not so much the backlinking but it's the content itself. Much of the content is from the books I have written and the premonitions I give. I also do channeling work and other things in the unseen realms that people love to copy. Unfortunately even my Youtube videos, which have ME in it, that material is taken by others and they recreate their own videos claiming that I copied their stuff. Anyone with brains in their heads can look at the dates and see that it couldn't even be possible (besides the point that I don't watch other people's stuff).

          This is just an extra layer to discourage people. I'm still trying to figure out how to take off the "download now" button on the Youtube videos. I see some videos that have the "download now" button disabled, but I can't figure that out for my videos.

          Thank you for your help - you're simply awesome!
          {{ DiscussionBoard.errors[8188962].message }}
    • Profile picture of the author Core Freedom
      Originally Posted by Alex Blades View Post

      Put in inside the head tag, toward the bottom away from your other codes.
      Originally Posted by wordpressmania View Post

      Open you header.php file. Find the following HTMl tag ending....


      </head>


      Place your code above </head> tag.
      Originally Posted by Social App Zone View Post

      Here is the correct code. It uses Jquery.

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
      <script type="text/javascript">
      <!--
      // Disabling context menu and copy
      $(document).ready(function () {
      $('body').bind('contextmenu copy', function (e) {
      alert('All material on this site is copyright protected. Thank you for honoring our terms and conditions. We encourage you to share our URL or use the social networking buttons made available on every page.');
      e.preventDefault();
      });
      });
      // -->
      </script>

      See working demo here --> http://www.lolyee.net/log-with-lips.php

      Yesss! This did the trick! Thank you so much!

      About the right-click nuisance and its impossiblity, I know. But you have to remember that my clientele is not technical whatsoever. Yes, they could hire someone but the type of people I deal with are most likely too ethical and won't bother going through the extra trouble. It's the rest who are looking for a free ride to steal my material that I'm concerned about. I give a lot of premonitions and if I can discourage a few, it's worth it. :-)

      Thank you all! (where is the heart faced smiley?)
      {{ DiscussionBoard.errors[8188926].message }}
      • Profile picture of the author Social App Zone
        Originally Posted by Core Freedom View Post

        Yesss! This did the trick! Thank you so much!
        No problem It was a little tricky as it needed to reference the Jquery library at Google.
        {{ DiscussionBoard.errors[8188966].message }}
        • Profile picture of the author Core Freedom
          Reviving this thread. :-) Am realizing that the code works great for Firefox but is not active for Chrome or Safari users, who still can freely copy. Hhm.

          Does anyone have any suggestions?
          {{ DiscussionBoard.errors[8358884].message }}
          • Profile picture of the author bengirwb
            Originally Posted by Core Freedom View Post

            Reviving this thread. :-) Am realizing that the code works great for Firefox but is not active for Chrome or Safari users, who still can freely copy. Hhm.

            Does anyone have any suggestions?
            There is software called switchblade
            It slices the image and only shows a small part when right clicked
            The user can not figure out how to the get the other pieces in proper order
            {{ DiscussionBoard.errors[8358904].message }}
          • Profile picture of the author SunilTanna
            Press ctrl u in firefox. Even if the code works against right click, you can't stop that.

            The best way to stop right flick on images, is to chop them up into segments and line the segments up using CSS or tables. That way a right click can only save a segment of your image. And you can make right click save even more painful by making the segments part of th background and overlaying with transparent gifs.

            But then people cam get round that too: just take a screenshot.

            The web isn't designed for drm, because you hav bno control over the type of hardware or software people use to read your stuff. An solution is bond to be a compromise for this reason.
            Signature
            ClickBank Vendor?
            - Protect Your Thank You Pages & Downloads
            - Give Your Affiliates Multiple Landing Pages (Video Demo)
            - Killer Graphics for Your Site
            SPECIAL WSO PRICES FOR WARRIORS + GET THE "CLICKBANK DISCOUNT" TOO!
            {{ DiscussionBoard.errors[8358951].message }}
    • Profile picture of the author Bellerine
      Thanks! The code did exactly what it was supposed to. Unfortunately, it also messed up my check out process. Any hints on why or how to incorporate the function without breaking the checkout process?
      {{ DiscussionBoard.errors[8359106].message }}
      • Profile picture of the author substance
        No need to go writing codes, All I do is use the copy safe plugin and all right click is disabled.

        Easy Pezzy...
        Signature
        When you are joyous, look deep into your heart and you shall find it is only that which has given you sorrow that is giving you joy. When you are sorrowful look again in your heart, and you shall see that in truth you are weeping for that which has been your delight.
        --- Khalil Gibran
        {{ DiscussionBoard.errors[8359802].message }}
  • Profile picture of the author Lloyd Buchinski
    Hi Core, I tested the first one too, just before the /head tag, and it didn't work so I think it's the script.

    The one just posted by Social App Zone does work.

    Not that I've even got a use for this but just in case it could come in handy, I'll file it away.
    Signature

    Do something spectacular; be fulfilled. Then you can be your own hero. Prem Rawat

    The KimW WSO

    {{ DiscussionBoard.errors[8188605].message }}
  • Profile picture of the author Alex Mensah
    If you just want to disable the right click on images then use this plugin so you dont have to mess with no codes.
    http://wordpress.org/plugins/no-right-click-images-plugin
    {{ DiscussionBoard.errors[8188972].message }}
  • Profile picture of the author Kingfish85
    Rule of thumb - If I can view it in my browser, I can copy it. Doesn't matter how it's chopped up, put in tables etc.
    Signature

    |~| VeeroTech Hosting - sales @ veerotech.net
    |~| High Performance CloudLinux & LiteSpeed Powered Web Hosting
    |~| cPanel & WHM - Softaculous - Website Builder - R1Soft - SpamExperts
    |~| Visit us @veerotech Facebook - Twitter - LinkedIn

    {{ DiscussionBoard.errors[8358958].message }}
  • Profile picture of the author Core Freedom
    I had the theme people help me out (such a great support group), and they said to use this code in the main.js:

    <script type="text/javascript">
    jQuery(document).ready(function(){
    jQuery('body').bind('contextmenu copy', function (e) {
    alert('Our website and all its content are copyright protected. If you are a member, please use the REPLY button. If you are not a member, thank you for honoring our Terms and Conditions; rather than copying content from our site, please share the URL with your friends and family and your social networking sites.');
    e.preventDefault();
    });
    });
    </script>



    It works. It disables right-click AND ctrl+c. Yes, a pro would find a way around it but my average visitor will be swayed. I use tynt and the report of what gets copied (before installing this script), was just outrageous. :-)
    {{ DiscussionBoard.errors[8436747].message }}

Trending Topics