Created
September 14, 2020 18:00
-
-
Save 0x00000FF/bfb0abf868ebb79a8068cfd1ef715f06 to your computer and use it in GitHub Desktop.
Prevents printing, context menu, and copy and developer console
This file contains 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
<style> | |
@media print { * { display: none } } | |
</style> | |
<script> | |
document.addEventListener("contextmenu", function (e) { | |
e.preventDefault(); | |
}); | |
document.addEventListener("mousedown", function (e) { | |
e.preventDefault(); | |
}); | |
document.addEventListener("click", function(e) { | |
if (e.button == 2) e.preventDefault(); | |
}); | |
document.addEventListener("keydown", function(e) { | |
if (e.keyCode == 123) e.preventDefault(); | |
else if (e.ctrlKey && e.keyCode == 67) e.preventDefault(); | |
else if (e.ctrlKey && e.keyCode == 83) e.preventDefault(); | |
else if (e.ctrlKey && e.keyCode == 80) e.preventDefault(); | |
else if (e.ctrlKey && e.shiftKey && e.keyCode == 73) e.preventDefault(); | |
}); | |
document.querySelector("script").remove(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment