Skip to content

Instantly share code, notes, and snippets.

@FelipeBudinich
Last active February 18, 2022 10:24
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Javascript, Disable context menu on right click
<!DOCTYPE html>
<html>
<head>
<title>Javascript, Disable context menu on right click</title>
<script type="text/javascript">
if (document.addEventListener) {
document.addEventListener('contextmenu', function (e) {
e.preventDefault();
}, false);
} else {
document.attachEvent('oncontextmenu', function () {
window.event.returnValue = false;
});
}
</script>
</head>
<body>
</body>
</html>
@idodidodi
Copy link

It works, thank you.

@firewood3
Copy link

Thank you!

@wavyyy1337
Copy link

Thank you:)

@hamzaa53
Copy link

How can i open back with any button?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment