Попробуйте следующее решение:
manifest. json
{
"manifest_version": 2,
"name": "test",
"description": "google chrome extension",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png"
},
"background": {
"scripts": ["background.js"]
},
"permissions": [
"tabs"
]
}
фон. js
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { // listener for tab opens
if (changeInfo.status == 'loading') { // when the page is loading (you can do info.status === 'complete' but you will see the page for a second or two)
if (tab.url === "https://www.youtube.com/watch?v=ABCDefgHIJK") {
chrome.tabs.query({ // change the tab url
currentWindow: true,
active: true
}, function (tab) {
chrome.tabs.update(tab.id, {
url: 'https://zymernation.com/wp-content/uploads/2019/05/Internet-Access-Error-e1558967567821.jpg'
});
});
}
}
})