0

I would need to know if the context menu has been opened for my JavaScript program.
I have to execute a function only when I see that the context menu is opened.

Could you help me?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
user2302725
  • 463
  • 6
  • 20

1 Answers1

1
document.addEventListener('contextmenu', function() {
    console.log('ya right');
});

The above snippet logs ya right when the user right clicks.

Andreas Louv
  • 46,145
  • 13
  • 104
  • 123