Skip to content

Instantly share code, notes, and snippets.

@ridheshcybe
Created September 28, 2021 15:24
Show Gist options
  • Save ridheshcybe/4569b0d629b1d00b0de5c74beefa0eb4 to your computer and use it in GitHub Desktop.
Save ridheshcybe/4569b0d629b1d00b0de5c74beefa0eb4 to your computer and use it in GitHub Desktop.
document.addEventListener("keydown", function(e){
// USE THIS TO DISABLE CONTROL AND ALL FUNCTION KEYS
// if (e.ctrlKey || (e.keyCode>=112 && e.keyCode<=123)) {
// THIS WILL ONLY DISABLE CONTROL AND F12
if (e.ctrlKey || e.keyCode==123) {
e.stopPropagation();
e.preventDefault();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment