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

202
Vistas
React/Chrome extension - How to modify content of popup on URL change?

I'm learning Chrome extension development and want to update the content of my popup whenever theres change to the URL (Not a tab change!).

My content script is basically accessing the DOM and grabs some text to set as a name within Chrome localStorage. popup.js then retrieves the name from localStorage and outputs within the pop.up.

Problem: How can I re-run the content script whenever the current pages URL changes? I think I would need to use chrome.tabs.onUpdated.addListener but unsure of how to implement. How can I best implement this functionality?

So far I have the following:

contentScript.js

// Store name in localStorage
chrome.storage.local.set({ name });

popup.js

// Get name from localStorage and set as some state
useEffect(() => {
    chrome.storage.local.get('name', (data) => {
        setName(data.name);
    });
}, []);

manifest.json

"permissions": ["storage", "tabs"],
"content_scripts": [
    {
        "matches": ["https://site.storm.com/*"],
        "js": ["contentScript.js"]
    }
about 4 years ago · Santiago Trujillo
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