-
Notifications
You must be signed in to change notification settings - Fork 5k
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 判断页面更新的机制 #411
Comments
研究了下,我现在改成了通过判断 res 的 content-length 来决定是否需要更新当前页面,一般情况下修改一个页面其 content-lenght 是会变化的,其他页面即使是重新 build 一遍,只要内容没变 content-lenght 就不变,那么就不会被弹更新通知。 不知这个思路有什么问题没? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
看到
sw.js
里面有这么一个逻辑:是使用资源的
last-modified
是否有变化来决定是否通知用户页面有更新,但是这里有个问题是,假设我只是修改了about
页面,当我打开首页的时候,也会收到页面更新的通知;然后,我再打开about
页面,依然会收到页面更新的通知。更糟的是,只要我更新了任意一个
page
或者post
,打开任意一个页面的时候,都会提醒我需要更新页面,点了更新之后,再打开其他页面,还是会让我更新页面。那么:
index
或者page1
orpage2
提醒更新呢?更新
即可,之后后续再打开任意页面都不会再提醒有更新呢?另外:
我是使用了 build 后的位于 _site 下的文件放在了 GithubPages,没有直接将源码暴露出来,二者在两个仓不同的仓库中,每次 源码 build 后会
-force
更新 GithubPages 的内容:https://github.com/Xheldon/x_blog@Huxpro
谢谢!
The text was updated successfully, but these errors were encountered: