I would like to disable the context menu that appears after a long tap (touch and hold) on images in my web application. I've seen posts with different ideas how to do it, but none of them seem to work for me.
Is there a way to do this on Android via HTML/CSS/Javascript?
A context menu is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.
The context menu has its own event. You just need to catch it and stop it from propagating.
window.oncontextmenu = function(event) { event.preventDefault(); event.stopPropagation(); return false; };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With