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

213
Views
How to get over a blocked event?

I'm developing an JavaScript app which needs to trigger mousemove event, and I am using tampermonkey to "embed" it on websites to test if it works on them. On one website, the mousemove event is simply blocked (I don't know why) and even console.log within this event doesn't show. It seems like this event has never triggered (the website ignores).

Is it possible to "override" events and block them? If so, how can I override this action and enable my specific mousemove event?

This script won't work:

document.addEventListener("mousemove", function(e) {
    e = e || window.event;
    e.stopPropagation();
    console.log("[HELLO] Is it moving?!");
}, false);

(the result will be... nothing. this won't be logged)

Update They set window.onmousemove as null. Is there any way to revert this?

about 4 years ago · Santiago Gelvez
2 answers
Answer question

0

If some other event handler called stopPropagation() on the event, it won't be propagated up to the document level during the "bubble" phase.

However, you can make your event handler be called sooner, by running it in the "capture" phase. Simply change the third argument from false to true. This will solve most issues, except if some other event handler on the document was added before yours, and calls stopImmediatePropagation on the event. But this is rare.

See Bubbling and capturing explained for more background information.

about 4 years ago · Santiago Gelvez Report

0

If you can run your code before theirs, you can save the function

window.onmousemove = function()  {
  console.log("moving",new Date())
};
window.myMove = window.onmousemove;
document.getElementById("x").addEventListener("click",function() {
  window.onmousemove=null
})

document.getElementById("y").addEventListener("click",function() {
  window.onmousemove=myMove;
})
<button type="button" id="x">Turn off mousemove</button>
<button type="button" id="y">Turn mousemove back on</button>

about 4 years ago · Santiago Gelvez 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!