Last active
August 17, 2023 14:05
-
-
Save pbaruns/2a0473a3228b6cb53eda070f4213eed8 to your computer and use it in GitHub Desktop.
This code disables F12 key and the shortcut ctrl shift i combination
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//disable F12 Key and Ctrl + shift + I combination | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script> | |
$(document).keydown(function (event) { | |
if (event.keyCode == 123) { // Prevent F12 | |
alert('Content is protected\nYou cannot view the Dev Tools.'); | |
return false; | |
} else if (event.ctrlKey && event.shiftKey && event.keyCode == 73) { // Prevent Ctrl+Shift+I | |
alert('Content is protected\nYou cannot view the Dev Tools.'); | |
return false; | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment