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

227
Views
How to use chrome.runtime.sendMessage in javascript?

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

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!