-1

I am trying to disable users of my html site from pressing right click. I already have a response to this prepared, but I cannot figure out how to run that code when someone presses right click. Does anyone know how to solve this? (I would prefer JavaScript, but I mean if it works it works)

Eli S
  • 1
  • 1

1 Answers1

0

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

but why would you do this? Anyone can run your client side code through a debugger and work around it. Most people try to keep people from seeing their source code which is a futile attempt with the open nature of web browsers.

chovy
  • 72,281
  • 52
  • 227
  • 295