How to disable right click on your website using javascript?

How to disable right-click on your website using javascript? [STEP BY STEP]☑️Disable right click on website using javascript

Today in this documentation we will learn how to disable right-click on your website via javascript.

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

How to disable right click on your website using javascript

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

How to disable right click on your website using javascript

Here we taking sample.html for demonstration purposes.

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

How to disable right click on your website using javascript

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 the Save changes button and close the editor.

How to disable right click on your website using javascript

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

How to disable right click on your website using javascript

Thanks for reading this article !!! We hope this was helpful to you all.

Video Tutorial- “How to disable right click on your website using javascript?”

For more information, kindly follow us on social media like Twitter and Facebook, and for video tutorials, subscribe to our YouTube channelhttps://youtube.com/redserverhost.com 

Facebook Page https://facebook.com/redserverhost

Twitter Pagehttps://twitter.com/redserverhost.com

If you have any suggestions or problems related to this tutorial, please let us know via the comment section below.

Tags: cheap linux hostingbuy linux hostingcheap reseller hostingbuy reseller hostingbest reseller hostingcheap web hostingcheapest web hostingcheapest reseller hosting,  cheap reseller hostcheap linux hostcheapest linux hostingbest linux hostingbest web hosting

Scroll to Top