Read cookies from within a Service Worker?

2019-01-26 14:52发布

问题:

I would like to read a cookie within my service worker to use it when setting up my caches, but can't find any way of doing it.

Is there any way of doing that, or will I need to duplicate cookie data into IDB or similar?

回答1:

Currently, you can't access them. There's a discussion in the W3C ServiceWorker repo about adding methods to access them in the future.