Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brenogcota/8d3d82afbffb841935231adb17f5a87f to your computer and use it in GitHub Desktop.
Save brenogcota/8d3d82afbffb841935231adb17f5a87f to your computer and use it in GitHub Desktop.
Disable | Enable Right Click
// 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