Disable right click

While working on a content heavy site, there was a requirement to disable the right click on the site to avoid direct copy of content.

Though there are multiple ways to copy the content and the images from the site, but below is nifty little JavaScript for disabling right click on the site

<!-- edit start -->
<script type="text/javascript">
jQuery(document).ready(function () {
//disable cut copy paste on site
jQuery('body').bind('cut copy paste', function (e) {
e.preventDefault();
});
//disable mouse right click on site
jQuery("body").on("contextmenu",function(e){
return false;
});
});
</script>
<!-- edit end -->

Hope this is helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top