Reputation:
for a website, I would like to not allow for CTRL-U
or inspect element on chrome browser. I have seen webpages with it, and I would like to be able to do it on my web page. How can I do this (HTML5 is acceptable too.)
Upvotes: 1
Views: 183
Reputation: 7361
this bit of javascript worked for me:
document.addEventListener("keydown", function(e) {
if (e.keyCode == 85 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) {
e.preventDefault();
alert(("ctrl-u pressed!")) }
}, false);
Upvotes: 1