Skip to content

Instantly share code, notes, and snippets.

@akashsky44
Created April 13, 2020 11:06
Show Gist options
  • Save akashsky44/2388707f00bfa3ab27d0c5494a337868 to your computer and use it in GitHub Desktop.
Save akashsky44/2388707f00bfa3ab27d0c5494a337868 to your computer and use it in GitHub Desktop.
codeSecurity or Right Click and Ctrl+u disable
var codeSecurity = function() {
document.onkeydown = function(e) {
if (e.keyCode === 123 || (e.ctrlKey &&
(e.keyCode === 67 ||
e.keyCode === 115 ||
e.keyCode === 99 ||
e.keyCode === 85 ||
e.keyCode === 117))) {
return false;
} else {
return true;
}
};
document.addEventListener("contextmenu", function(e){
e.preventDefault();
}, false);
$(document).keypress("u",function(e) {
if(e.ctrlKey){return false;}
else {return true;}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment