Disable Chrome paste menu on text inputs while on a touch screen

2.4k views Asked by At

How to disable this annoying contextmenu in chrome while on a touch screen. This pops up on selection/on long tap of any input while i have some text copied.

enter image description here

Am developing an app using CEFSharp (Chromium Embedded Framework) and its going to be deployed on touch screen on windows 8 machine. am using a on screen keyboard(http://mottie.github.io/Keyboard/) for entering text in input fields.

I have tried

            $('input').bind('copy paste contextmenu', function (e) {
                e.preventDefault();
                e.stopPropagation();
            });

this disables the pasting but the menu still shows up. how do i get rid of this menu? how best to approch this: CSS , Javascript or through chrome command line arguments (http://peter.sh/experiments/chromium-command-line-switches/) ?

1

There are 1 answers

6
AudioBubble On

i know you said JS / CSS, but this worked for me

var browser = new ChromiumWebBrowser("http://www.afrobotics.co.za")
{
  Dock = DockStyle.Fill,
  DragHandler = new DragHandler(),
  MenuHandler = new ContextHandler()
};

// 
public class ContextHandler : IMenuHandler
{
    public bool OnBeforeContextMenu(IWebBrowser browser, IContextMenuParams parameters)
    {
        return false;
    }
}

public class DragHandler : IDragHandler
{
    public bool OnDragEnter(IWebBrowser browser, IDragData dragData, DragOperationsMask mask)
    {
        return true;
    }
}