After creating an add-on that manipulates a specific site's HTML based on user settings in the add-on's 'popup', I encountered an issue. The add-on is supposed to run a continuous content script when the user opens the site, but it only works if the user loads the site, opens the add-on 'popup', returns to the site, and then the script kicks in.
I need help fixing this issue. How can I make the script run automatically when the user opens the site? This problem seems to be specific to Android, as it does not occur on Chrome or desktop Firefox.
Below is the manifest.json code snippet:
{
"name": "9gag post filter",
"description": "A post filter for 9GAG.com",
"version": "1.1.2",
"browser_specific_settings": {
"gecko": {
"id": "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2c4d4145584e43474348495a6c4b414d4540024f4341">[email protected]</a>",
"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/*"]
}]
}
If you wish to view the complete source code, it is available on GitHub (it's open source).