Access localStorage from service worker
You cannot access localStorage (and also sessionStorage) from a webworker process, they result will be undefined, this is for security reasons. You need to use postMessage() back to the Worker’s originating code, and have that code store the data in localStorage. You should use localStorage.setItem() and localStorage.getItem() to save and get data from local storage. … Read more