Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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