Search code examples
javascriptgoogle-chromegoogle-chrome-app

how to disable chrome application context menu


I can not figure out how to hide the context menu on my chrome app for the love of god i'v tried this

document.addEventListener('contextmenu', event => event.preventDefault());

but it only works in the browser not in the apps html file i tried

document.addEventListener("contextmenu", function(e) {
e.preventDefault();
});

also wont work what do i do


Solution

  • Try it on the body of the document like this...

    document.body.addEventListener('contextmenu',function(e){ SomeFunc(); },false);