Disable context menu on video element
You can check whether the right mouse button was clicked with event.which in jQuery.
1 refers to left, 2 to middle and 3 to right mouse button.
Try to bind your contextmenu overwrite function when the right button is clicked and unbind it otherwise. I think that should do the trick.
$(document).ready(function () {
$('.video-container').mousedown(function(event) {
if(event.which === 3) {
$('.video-container').bind('contextmenu',function () { return false; });
}
else {
$('.video-container').unbind('contextmenu');
}
});
});
Disable right click on html5 audio element
Using oncontextmenu="return false;"
seems to work when the JavaScript doesn't.
Related Topics
How to Avoid the Setstate()/Render() Endless Loop When Passing Data from Child to Parent
Javascript Sum and Group by of Json Data
React Native: Image Not Displaying With Dynamic/Local Uri
Use Localstorage Variables in PHP
What Is the Purpose of the Dollar Sign in JavaScript
Merge Array of Objects by Same Key-Value
Puppeteer Wait Until Page Is Completely Loaded
How to Get Dynamically Generated Table Td Input Value
How to Redirect to Another Component Onsubmit Search
Adding Whitespace to a String in Typescript (In Angular)
Remove Everything After Last Backslash
Reactjs: Expected Onclick Listener to Be a Function, Instead Got Type String
Error Ts2739: Type '{}' Is Missing the Following Properties from Type
Vue Router This.$Router.Push Not Working on Methods
Get Part of the Url Pathname Via JavaScript Regex
How to Convert from Google Sheet Date Number Value to JavaScript Date