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

288
Views
Manifest V3, background service worker and popup.html

If I use a background.js service worker to inject js into the web page. 

chrome.action.onClicked.addListener(async tab => { try { await chrome.scripting.executeScript({ target: { tabId: tab.id, allFrames: true, }, files: ["script.js"], }); } catch (erri) { console.error(failed to execute script: ${erri}); } });

The javascript is loaded. I can see this working because it adds a class to the document body.  

However,

If I add a popup.html to the manifest, that opens a popup with a checkbox when the extension button is clicked, the background.js service worker no longer injects the script and the class  is not added to the document body. 

I can’t work out why. 

I’d appreciate some guidance how to inject the script into the document (web page) and also be able to have the popup functionality. 

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!