Step::1 Login to your cPanel and click on File Manager section

Step::2 Go inside public_html and edit the .html file for which you want to disable the right click option.

Here we taking sample.html for demonstration purpose.

Step::3 Right click over the file and choose the Edit option

Step::4 Enter the code given below under the body tag

<html>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></s
cript>
<script>
jQuery(document).ready(function(){
  jQuery(function() {
        jQuery(this).bind("contextmenu", function(event) {
            event.preventDefault();
            alert('Right click is disabled on this site!!')
        });
    });
});
</script>
 

</head>
<body>
Here is my code. Right click on me.
</body>
</html>


Step::5 Once you have added the code, click on Save changes button and close the editor.

Now test the file from a new tab in your web browser. You will find that right click has been been successfully disabled.

Visit our Blog for more details. You can also watch the video here.

Was this answer helpful? 0 Users Found This Useful (0 Votes)