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:
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!