I'm creating a google extension that redirects the user to a link whenever they open a new tab. I don't understand why the listeners aren't working though, the extension doesn't do anything when I open a new tab. Here is my manifest (manifest.json):
{
"name": "Insert Name Here",
"description": "Insert description here",
"version": "1.0",
"manifest_version": 3,
"action": {
"default_icon": "icon.png",
"default_popup": "hello.html"
},
"background.service_worker": {
"scripts": [ "popup.js" ],
"persistent": false
},
"permissions": [
"tabs"
]
}
Here is my javascript file (popup.js):
chrome.tabs.onCreated.addListener(function () {
chrome.tabs.update({
tabId: WINDOW_ID_CURRENT,
url: "https://www.youtube.com/*"
})
});
Nothing happens when I open the window and I would like it to redirect to a YouTube link whenever a new tab is opened.