I am trying to get localhost permission in my manifest.json
so I can use chrome.tabs.executeScript
but it is not working. I have tried nearly everything you can think of. Here is an example:
{
"manifest_version": 2,
"name": "extName",
"version": "1",
"description": "extDesc",
"content_scripts": [
{
"matches": [
"http://localhost:3000/*",
"http://127.0.0.1/*",
"http://*/*",
"https://*/*"
],
"css": [
"style.css"
],
"js": [
"contentScript.js"
]
}
],
"background": {
"scripts": [
"background.js"
]
},
"permissions": [
"activeTab",
"tabs"
]
}
But no matter what I try I keep getting
Error during tabs.executeScript: Cannot access contents of url ....
Extension manifest must request permission to access this host.
Actually, I think it's happening also not on localhost
Here is my background.js:
chrome.runtime.onMessage.addListener(
function(message, callback) {
if (message == "runContentScript"){
chrome.tabs.executeScript(null, {
code: 'console.log(window.angular)'
});
}
});