Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda