I created an add-on that manipulates a speicfic site’s HTML based on the settings the user chooses in the add-on’s 'popup' (the settings are saved with ‘chrome.storage.local’, I just ported my code from chrome and it worked).
When the user opens a specific website, the add-on is supposed to run a continuous (interval) content script that changes the HTML, the problem is that it doesn’t, it requires the user to load the site, then open the add-on 'popup', then return to the site, and then the script starts working.
How can I fix that? How do I make the script run when the user opens the site? This is a problem only on android, not chrome or desktop firefox
Here's the manifest.json-
{
"name": "9gag post filter",
"description": "A post filter for 9GAG.com",
"version": "1.1.2",
"browser_specific_settings": {
"gecko": {
"id": "[email protected]",
"strict_min_version": "42.0"
}
},
"manifest_version": 3,
"permissions": [
"storage"
],
"action": {
"default_popup": "index.html"
},
"content_scripts": [{
"css": ["assets/css/content.css"],
"js": ["assets/js/jquery_slim_mini.js","assets/js/content.js"],
"matches": ["https://9gag.com/*"]
}]
}
And the whole source code (it's open source)
This issue occurs not only on Android, but also on Desktop Firefox with newly installed extensions.
(This issue does not occur if you upgrade from Manifest v2)
This issue is caused by a lack of permissions. Firefox does not automatically grant execute permissions to the content_scripts domain in Manifest v3.
For now, you must specify host_permissions and request permissions yourself.
Detail: 1810910 - Extension manifest v3 content_scripts registered scripts are not run