I wrote some extensions a while ago with manifest v2 and now wanted to write a new one but somehow I cannot get the background.js to run. Meaning that the script does seemingly not execute at all.
manifest.json
{
"manifest_version": 3,
"name": "extension",
"description": "example",
"version": "1.0",
"permissions": [
"scripting",
"tabs"
],
"host_permissions": ["https://*.example.com/*"],
"background": {
"service_worker": "background.js"
},
"action": {
"default_title": "Click Me",
"default_popup": "popup.html"
}
}
content_script.js
chrome.runtime.sendMessage({
url: window.location.href,
})
background.js
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
console.log("Foo")
})
I'm also getting this console output:
Manifest: property 'url' ignored, should be within scope of the manifest.
Manifest: property 'url' of 'shortcut' not present.