How To Disable Right Click & F12 Key on a Website Using Javascript

Disable Right Click & F12 Key on a Website Using Javascript

Disable Right Click & F12 Key on a Website Using JavaScript is so simple that any person with little knowledge about programming and JavaScript can easily insect codes and disable right clicks on his/her website and blogs. In this article, we are going to discuss how to stop Right Click of the mouse, f12 keys on your website.

It is almost necessary for a blogger to protect his content from being copied in the field of blogging. Continue the blogging profession is more important that just start a blog and leave it soon.

Important:

Just copy and paste the below code into your website head section. If your website in WordPress, just install a plugin – Insert header and Footer and paste the below code above in the Head section. If you are using any other platform then find the </head> section and paste the below code just above the </head>.

JavaScript to Disable Right Click & F12 Key

<script>
	window.oncontextmenu = function () {
				return false;
			}
			$(document).keydown(function (event) {
				if (event.keyCode == 123) {
					return false;
				}
				else if ((event.ctrlKey &amp;&amp; event.shiftKey &amp;&amp; event.keyCode == 73) || (event.ctrlKey &amp;&amp; event.shiftKey &amp;&amp; event.keyCode == 74)) {
					return false;
				}
			});
		</script>

We hope this article helped you learn how to easily disable right click and F12 Key on your website and also helps you to protect your content from being copied.

Share with Care ❤️

Leave a Reply