How to disable right click on website.

How to disable right click on website.

To disable right-clicking on a website, you can add the following JavaScript code to your website’s HTML:

phpCopy code<script>
document.addEventListener("contextmenu", function(e){
  e.preventDefault();
}, false);
</script>

This code will prevent the context menu from appearing when a user right-clicks on your website. However, it is important to note that disabling right-clicks can negatively impact user experience and can also be bypassed by advanced users. Additionally, some users with disabilities rely on right-clicks for accessibility, so it is generally not recommended to disable right-clicks on your website.

Leave a Reply