I am working on building a Chrome extension that uses css and html elements to block certain parts of the YouTube page. The issue is, the json script only seems to execute the css files the FIRST time I go on the url; any pages/redirects afterwards requires for a hard refresh/reload to get the script working properly again. I am using Chrome’s “load unpacked” to load my extension and here is the json file I am using:
(note: all the css files work properly, I just can’t get them to continuously work without refreshing each YouTube page)
{
"manifest_version": 3,
"name": "Locked In for YouTube - Productivity & Focus",
"version": "1.0",
"description": "Stay 'locked in' by removing distracting elements that keep you away from your work such as recommended, Shorts, trending tab, etc.",
"permissions": ["activeTab"],
"content_scripts": [
{
"matches": ["*://www.youtube.com/*"],
"css": ["homepage.css"]
},
{
"matches": ["*://www.youtube.com/feed*"],
"css": ["feed.css"]
},
{
"matches": ["*://www.youtube.com/results*"],
"css": ["results.css"]
},
{
"matches": ["*://www.youtube.com/watch*"],
"css": ["watch.css"]
},
{
"matches": ["*://www.youtube.com/@*"],
"css": ["channel.css"]
}
]
}
Houdiee is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.