Created
July 28, 2016 23:18
-
-
Save AllThingsSmitty/13a88cdf7029eb901ea9a2c301708142 to your computer and use it in GitHub Desktop.
Disable right-click menu
This file contains hidden or 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
// credit: Louis Lazaris | |
window.addEventListener('contextmenu', function (e) { | |
console.log('context menu disabled'); | |
e.preventDefault(); | |
}, false); | |
document.addEventListener('mouseup', function (e) { | |
if (e.button === 2) { | |
console.log('right-click enabled'); | |
} | |
}, false); | |
// https://jsbin.com/diyihu/edit?html,css,js,console,output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment