hexo-offline icon indicating copy to clipboard operation
hexo-offline copied to clipboard

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

Open kainy opened this issue 5 years ago • 1 comments

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文件。

kainy avatar Mar 11 '19 13:03 kainy

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.

JLHwung avatar Mar 15 '19 00:03 JLHwung