chrome.tabs.executeScript not working?

Make sure you have domain and tab permissions in the manifest:

"permissions": [
    "tabs", "http://*/*", "https://*/*"
]

Then to change body color try:

chrome.tabs.executeScript(null,{code:"document.body.style.backgroundColor="red""});

Also keep in mind that content scripts are not injected into any chrome:// or extension gallery pages.

For those of you still having issues, you need to make sure to reload the extension’s permissions in Chrome.

Go to chrome://extensions , scroll to your extension, and click on “reload”. Make sure that your permissions have been updated by clicking on the permissions link right next to your extension.

Leave a Comment