Skip to content

Instantly share code, notes, and snippets.

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

This comment has been minimized.

Copy link

@idodidodi idodidodi commented Jan 24, 2019

It works, thank you.

@firewood3

This comment has been minimized.

Copy link

@firewood3 firewood3 commented Oct 11, 2019

Thank you!

@wavyyy1337

This comment has been minimized.

Copy link

@wavyyy1337 wavyyy1337 commented Apr 21, 2020

Thank you:)

@hamzaa53

This comment has been minimized.

Copy link

@hamzaa53 hamzaa53 commented Sep 22, 2020

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
You can’t perform that action at this time.