Skip to content

Instantly share code, notes, and snippets.

@fzzzy
Created November 5, 2014 20:49
Show Gist options
  • Save fzzzy/e36cec762420e91d2334 to your computer and use it in GitHub Desktop.
Save fzzzy/e36cec762420e91d2334 to your computer and use it in GitHub Desktop.
Disable contextmenu on video tag
<!DOCTYPE html>
<html>
<head>
<title>Video Test</title>
</head>
<body>
<video src="gizmo.mp4" autoplay controls id="content">
</video>
<script>
document.getElementById('content').oncontextmenu = function(e) {
var div = document.createElement("div");
div.textContent = "contextmenu";
document.body.appendChild(div);
e.preventDefault();
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment