Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!