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

146
Views
Chrome scripting in all subframes

I'm trying to get a script to execute in all tabs and it seems to conditionally work. It works on pages without frames, but on pages with frames and subframes it fails to execute. Here's an example:

This seems to be no problem

This does...

I'm sure that it's something about the activeTabs permissions in the manifest.json file, but as of now, I'm lost. I'm so close to building the extension that I want, but this stops the whole thing. I'd appreciate any advice people have!

Here's the code to trigger the function:

document.getElementById('red').onclick = () => {chrome.tabs.query({},(tabs) => {
    for(var i = 0; i < tabs.length; i++) {
        chrome.scripting.executeScript({
            target:{tabId:tabs[i].id, allFrames: true},
            function: setBackGroundColorRed
            });
    }
    });
}

...and here's the function:

function setBackGroundColorRed(){
    document.body.style.backgroundColor= 'red';
}

I really could use a hand. Thanks folks!

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!