Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

注入 'service-worker.js' 的脚本路径应该在根目录吧。 #83

Open
kainy opened this issue Mar 11, 2019 · 1 comment
Open

注入 'service-worker.js' 的脚本路径应该在根目录吧。 #83

kainy opened this issue Mar 11, 2019 · 1 comment
Labels

Comments

@kainy
Copy link

kainy commented Mar 11, 2019

image

如果是类似 https://blogs.kainy.cn/2018/07/%E5%8D%9A%E5%AE%A2%EF%BC%8F%E8%B5%84%E8%AE%AF%E7%B1%BB%E7%BD%91%E9%A1%B5%E5%9C%A8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E4%B8%AD%E5%88%86%E4%BA%AB%E7%9A%84%E6%96%B9%E6%A1%88/ 的URL结构,就会导致访问不到sw.js文件。

@JLHwung
Copy link
Owner

JLHwung commented Mar 15, 2019

Hi kainy, the sw.js should only be registered once at top-level entry page (for best practice, see here) and it will send all files to the service-worker. That is to say, it is ok for any subpage not reading sw.js register as long as the sw.js have been invoked at the entry page of your website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants