Disabled Right Click On Web Site

steps :

1) create simple application (html).

2) put the below javascript in to the code.

<script language="JavaScript">
      // on right click appear this message
      var DisplayMsg="Right Click Disabled";
      //return message
      function clickBYIE()
      {
          if(document.all)
          {
              alert(DisplayMsg);
              return false;
          }
      }
      //return message
      function clickBYNS(e)
      {
          if (document.layers||(document.getElementById&&!document.all))
          {
              if (e.which==2||e.which==3)
              {
               alert(DisplayMsg);
               return false;
              }
          }
      }

     //set the function as per browser
      if (document.layers)
      {
          document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickBYNS;
      }
      else
      {
          document.onmouseup=clickBYNS;document.oncontextmenu=clickBYIE;
      }
      //disabled the right click on the browser
       document.oncontextmenu=new Function("return false")
  </script>
run the code and check.
thnx

7 responses to “Disabled Right Click On Web Site”

  1. Chrislo27 Avatar

    How do you make a simple application (html)?

    1. patriwala Avatar

      I am not getting what you say?

  2. Patrick Avatar

    He probably meant just a plain simple html file !! I haven’t tried this but will it work on WP ?

  3. Nicko ¢ρ¢нєαтѕяιgнтѕ ѕℓινєя мє∂αℓ ωιηηєя Avatar
    Nicko ¢ρ¢нєαтѕяιgнтѕ ѕℓινєя мє∂αℓ ωιηηєя

    It says you need to make a “simple html application”. How do you do this using a WordPress.com blog?!

  4. Michael Avatar

    It won’t work for WordPress. You could just put the HTML code in a text widget and that would work. But it won’t because Javascript is disabled on WordPress.

  5. James Carpenter Avatar
    James Carpenter

    Just whack the script into your header.php!

  6. kristina Avatar
    kristina

    hi would inserting this script mentioned stop right click downloads of video that is in a wordpress site?

Leave a Reply

Discover more from The Engineering Behind Enterprise AI

Subscribe now to keep reading and get access to the full archive.

Continue reading