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!