跨多个子域使用 Service Worker [英] Using service workers across multiple subdomains
本文介绍了跨多个子域使用 Service Worker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我的 Web 应用程序包含多个子域,这是否意味着我必须有多个 Service Worker,每个子域一个?或者我可以有一个跨子域工作的服务工作者吗?
If my web app consists of more than one subdomain, does that mean I have to have multiple service workers, one for each subdomain? Or can I have one service worker that works across subdomains?
推荐答案
每个子域都被认为是不同的来源,所以是的,您需要为每个子域注册一个 Service Worker.每个 worker 都有自己的缓存和作用域.
Each subdomain is considered a different origin, so yes, you will need to register a service worker for each one. Each of these workers will have its own cache and scope.
这篇关于跨多个子域使用 Service Worker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文