We are having a chrome extension built using manfiest V3 version.I am trying to use navigator.serviceworker in the background js which is registered as a service worker in the chrome extension but in background.js when running navigator.serviceWorker i am getting it as undefined. I tried using self.navigator.serviceWorker. Is there any way where we can access the serviceworker methods in background script for a chrome extension
I am trying to access serviceworker using
navigator.serviceWorker
in the manfest we have configured the background script in the below way
"background": {
"service_worker": "scripts/background.js"
},
for all the above possible way i am getting as undefined only when doing
console.log("Service worker --> ", navigator.serviceWorker)