'My extension for Google Chrome that blocks website, doesn't work on youtube, but on every other website it works
Description
I made this extension for google chrome, which blocks website by keyword and is working perfectly on all websites, but on youtube it doesn't work.
Is there any solution so that my extension works on youtube as well?
background.js
console.log("Loaded extension");
function blockRequest(details) {
return {cancel: true};
}
function updateFilters(urls) {
if(chrome.webRequest.onBeforeRequest.hasListener(blockRequest))
chrome.webRequest.onBeforeRequest.removeListener(blockRequest);
chrome.webRequest.onBeforeRequest.addListener(blockRequest, {
urls: [
"https://*/*"+ "mrbeast*"
]
},
['blocking']);
}
updateFilters();
maninfest.json
{
"name": "Foco Study",
"description": "Foco",
"version": "2.0",
"permissions": [
"webRequestBlocking",
"webRequest",
"activeTab",
"tabs",
"http://*/*",
"https://*/*",
"https://www.youtube.com/*"
],
"background" : {
"scripts": [
"background.js"
],
"matches": [
"*://www.youtube.com/*", "http://*/*",
"https://*/*"
]
},
"manifest_version": 2
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
