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
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.