Today in this post, we will show you how to disable right click on your website via javascript.
Step::1 Log on to your hosting cPanel and then select File Manager section
Step::2 Next now select 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 on the file and select the Edit option
Step::4 Type below code 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 After added the code, next step select the Save changes button and then close the editor.
Now if you wnat test open new tab in your web browser(and check wight click). You will see that right click has been been successfully disabled.
We hope this was helpful to you all.