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?
Regards.

Andreas Louv
  • 44,338
  • 13
  • 91
  • 116
user2302725
  • 453
  • 5
  • 17

1 Answers1

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

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

Andreas Louv
  • 44,338
  • 13
  • 91
  • 116