Im trying to use a simple service worker to send a message to the background script from the content script
but when i try to send it, i cant see the message in the service worker console
my content.js:
chrome.runtime.sendMessage("hello")
my background.js:
console.log("background running")
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
console.log(message)
})
my manifest.json:
{
"manifest_version": 2,
"name": "send message",
"version": "0.0.1",
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": ["content.js"]
}
],
"background": {
"service_worker": "background.js"
}
}
i don't know what im doing wrong
thanks for the help