Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disabling the context menu on long taps on Android

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?

like image 780
Roy Sharon Avatar asked Aug 05 '10 10:08

Roy Sharon


People also ask

What is Android contextual menu?

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.


1 Answers

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; }; 
like image 172
bbsimonbb Avatar answered Sep 21 '22 14:09

bbsimonbb