Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
Re-enabling right-click on web page: "Void document oncontextmenu null" trick not working

For testing purposes, I have disabled the right click function on a web page by adding the following JavaScript snippet code:

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

So far, so good.

Now, to re-enable the option using a code method, it is supposed to be enough to just type javascript:void(document.oncontextmenu=null); in the address bar of your Browser and press Enter. But this method seems not be working anymore. I do not know what is wrong with it and wonder if there is any similar alternative way, except toggling off JavaScript in Chrome?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

addEventListener() method can be removed with removeEventListener() method only

If you need your code working you need to assign the event with the oncontextmenu property

I mean that

document.oncontextmenu = (event) => {
  event.preventDefault();
}

It will work.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!