I have a scenario where i need to use setItem(key,value) method of browser local storage inside web worker . Could anyone of please let me know if there is any way to use the setItem method?
Asked
Active
Viewed 1,034 times
0
-
The `localStorage` is `undefined` in a webworker process also the `sessionStorage`, you cant – Muhammad Omer Aslam Jun 21 '18 at 13:58
-
Thanks Muhammad , could you please guide on any other similar option available that can be used instead? – Harmandeep Singh Kalsi Jun 21 '18 at 13:59
-
see this it might help you out https://stackoverflow.com/questions/6179159/accessing-localstorage-from-a-webworker – Muhammad Omer Aslam Jun 21 '18 at 14:00
-
Possible duplicate of [Accessing localStorage from a webWorker](https://stackoverflow.com/questions/6179159/accessing-localstorage-from-a-webworker) – Muhammad Omer Aslam Jun 21 '18 at 14:00
-
you might have to go for [**`IndexedDB`**](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) – Muhammad Omer Aslam Jun 21 '18 at 14:02