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

558
Vistas
Extension context invalidated - Chrome extension

I'm writing a screen capture chrome extension and it takes screenshots on the document "onClick" event.

Currently, I'm sending an event from my "popup script" and receiving it in the content script as you can see.

but after reloading the extension or updating it, I get the Extension context invalidated on each document click. reloading the tab will fix it but it's not the desired solution. this is my content script:

const sendMessage = (e) => {
  try {
    chrome.runtime.sendMessage({
      type: "screenshot"
    });
  } catch (e) {
    console.log("error", e);
  }
};

const handleClick = (e) => {
  e.stopImmediatePropagation();
  sendMessage(e);
};

const handleMessage = (request) => {
    document.addEventListener("click", handleClick, true);
};

chrome.runtime.onMessage.addListener(handleMessage);

I tried every solution that I find but didn't work perfectly. and I think this is a chrome bug, why they don't fix it?

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