Disable Right click & F12 Key Using Javascript | Hello everyone, in this article I will discuss on how to protect website content from being copied ,mean’s in this article I will show you how to disable mouse right click and keyboard F12 key using javascript.
Just copy and paste below code into your website head section .if your website in WordPress , so goto Appearance, Editor and find header.php file and paste below code above </head>.
<script>
window.oncontextmenu = function () {
return false;
}
$(document).keydown(function (event) {
if (event.keyCode == 123) {
return false;
}
else if ((event.ctrlKey && event.shiftKey && event.keyCode == 73) || (event.ctrlKey && event.shiftKey && event.keyCode == 74)) {
return false;
}
});
</script>
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently */
We hope this article helped you learn how to easily disable right click and F12 Key. You may also want to see – How To Change The Default WordPress Email Address.
If you liked this article, then please share to social networking site. You can also find us on Twitter,Facebook and Instagram.