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

119
Vistas
MutationObserver not working if tab not focused

I am working on a chrome extension and i have a problem with MutationObserver, not sure if i am missing something or it's the normal behavior. The observer works when i am on the chrome tab which uses the mutation i receive messages when changes happens normal, but when i am not on tab, either i am on another tab or another window nothing happens until i comeback to the tab where i use mutation.

exemple let's say i use stackoverflow.com on a tab where i observe mutation all good i get the changes then i keep my tab open and i switch to another tab, the mutations stopped working like if the dom doesn't update when i am on another tab till i comeback.

window.onload = () => {


  console.log("init observer");

  let mutationBinaryObserver = new MutationObserver(function (mutations) {
    mutations.forEach(function (mutation) {
      if (
        mutation.target &&
        mutation.target.className &&
        typeof mutation.target.className === "string" &&
        mutation.target.className.indexOf("dialog-subtitle-badge") >= 0
      ) {
        getChatMessages();
      }
    });
  });
});

Thanks for your help and advice, my goal is to be using my computer and receiving updates from a tab on chrome even if i am not focusing it.

about 4 years ago · Juan Pablo Isaza
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