Created
July 5, 2021 18:14
-
-
Save brenogcota/8d3d82afbffb841935231adb17f5a87f to your computer and use it in GitHub Desktop.
Disable | Enable Right Click
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
// disable | |
window.addEventListener('contextmenu', function (e) { | |
e.preventDefault(); | |
}, false); | |
// enable | |
document.addEventListener('contextmenu', function (e) { | |
e.stopPropagation(); | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment