Using service workers across multiple subdomains

前端 未结 3 1269
你的背包
你的背包 2020-12-06 06:06

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 work

3条回答
  •  -上瘾入骨i
    2020-12-06 06:44

    Each subdomain is considered a different origin and you must register a service worker for each origin but you can reuse the same source for the service worker by setting the Service-Worker-Allowed response header to the list of scopes the same source can control.

提交回复
热议问题