Created
November 5, 2014 20:49
-
-
Save fzzzy/e36cec762420e91d2334 to your computer and use it in GitHub Desktop.
Disable contextmenu on video tag
This file contains 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
<!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