Protect the content and images using JavaScript and CSS

Many time, we have write a good article with some good images .but we will after some time anyone do the same content  and images . So we need to protect with right key disable and we can protect image with drag and drop.


Java script:-
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

  <script type="text/javascript">
      $(document).bind("contextmenu", function (e) {
          e.preventDefault();
      });
</script>


With the below CSS we can stop drag and drop the image to desktop.

CSS code:-
  <style>
   img {
  pointer-eventsnone;


}
   </style>




Protect the content and images using JavaScript and CSS Protect the content and images using JavaScript and CSS Reviewed by NEERAJ SRIVASTAVA on 8:12:00 PM Rating: 5

No comments:

Powered by Blogger.