为什么服务人员无法访问Cookie [英] Why can't serviceworker access cookies

查看:81
本文介绍了为什么服务人员无法访问Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,服务人员无法访问Cookie。因此,我在为网站实施SW时遇到很多问题。

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.

我想知道服务人员是什么原因>无法访问Cookie。目前,我正在使用消息传递功能,将Cookie的内容传达给服务人员
是否有更好的方法或技巧可以更有效地做到这一点?

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?

推荐答案

没有理由。已经提出了一些用例,并且正在开发新API 。如果您的用例和见解还没有涉及,请确保它们在对话中很有用。

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.

您可以使用 postMessage() 到客户端以请求Cookie并发送交给服务人员。

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

这篇关于为什么服务人员无法访问Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆