Though document
is not accessible from web worker can i access some how the cookie? unless i send a postMessage
to main thread to give me cookie and it will send it via another postMessage
Asked
Active
Viewed 5,895 times
5

Fisherman
- 5,949
- 1
- 29
- 35
1 Answers
8
No, you can access neither cookies nor localStorage
("local cookies").
Apart from using postMessage
, you could also send a AJAX request to server to get/set a cookie. This is in no way more optimal of course - it will take way longer.

Community
- 1
- 1

Tomáš Zato
- 50,171
- 52
- 268
- 778
-
1or session storage either. Best to use IndexedDB – Nick Mitchell Sep 03 '21 at 00:18