Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

216
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda