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

163
Vistas
chrome extension send data from content to popup

I am trying to send the fontsize of the body to the popup of my extension (it is an extension of chrome), but there is no way to show it.

That's my content:

const body = document.querySelector('body');

const bodyFontSize = getComputedStyle(body).fontSize;

chrome.runtime.sendMessage({ fontSize: bodyFontSize }, function (response) {
 console.log(response);
});

Here is my background

const gotMessage = message => chrome.runtime.sendMessage({ msg: message });

chrome.runtime.onMessage.addListener(gotMessage);

and that is the popUp:

 const gotMessage = (message, sender, sendResponse) => {
   console.log('message,', message);
   sendResponse(sender);
 };

 chrome.runtime.onMessage.addListener(gotMessage);

I dont find the way to show in popUp some information from the DOM, in the other hand, that is my manifest

{
  "name": "WEEEWWWW",
  "version": "1.0.0",
  "manifest_version": 2,
  "description": "WOOOOWWW",
  "icons": {
    "512": "logo512.png"
  },
  "permissions": ["http://*/*", "https://*/*"],
  "browser_action": {
    "default_icon": "logo512.png",
    "default_popup": "popup.html"
  },
  "background": {
    "scripts": ["background.js"]
  },
  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"],
      "js": ["content.js"],
      "run_at": "document_end"
    }
  ]
}

Thanks a lot for any help!

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