Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pbaruns/2a0473a3228b6cb53eda070f4213eed8 to your computer and use it in GitHub Desktop.
Save pbaruns/2a0473a3228b6cb53eda070f4213eed8 to your computer and use it in GitHub Desktop.
This code disables F12 key and the shortcut ctrl shift i combination
//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