Hello, I am trying to develop a extension to redirects the page to
google.com if a 404 status code is reached without using netRequest API or webBlockingAPI
Here is my manifest file
{
"name": "404 Redirect",
"version": "1.0",
"description":
"Redirects to google.com if a 404 status code is reached",
"manifest_version": 3,
"permissions": ["activeTab"],
"background": {
"service_worker": "background.js"
}
}
and here is my background.js file
chrome.webNavigation.onCompleted.addListener(function (details) {
if (details.statusCode === 404) {
}
});
I am getting the following errors:
Service worker registration failed. Status code: 15
Uncaught TypeError: Cannot read properties of undefined (reading 'onCompleted')
What am I doing wrong?