Why can't serviceworker access cookies

拜拜、爱过 提交于 2019-12-23 09:34:40

问题


As per as i know Service Workers can not access the cookies. Because of this i am facing a lot of problems in implementing SW for my site.

I want to know what are the reasons, that Service Workers can not access the cookies.Right now I am using messaging to convey the cookie content to Service Workers. Is there any better way or hack to do it more efficiently?


回答1:


There is no reason. Some use cases have been proposed and a new API is under development. Sure your use case and insights are useful in the conversation if they are not covered yet.

You could use postMessage() to a client to request the cookies and send it to the service worker.



来源:https://stackoverflow.com/questions/35692988/why-cant-serviceworker-access-cookies

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!