igrigorik/hpbn.co

Links to anchors do not work offline

codl opened this issue · 3 comments

codl commented

If I go offline then only links to top-level chapters work, Links to specific sections within chapters with an anchor part, like https://hpbn.co/primer-on-latency-and-bandwidth/#speed-is-a-feature, fail to load

Updating to a more recent version of sw-precache should do the trick: GoogleChromeLabs/sw-precache#290

Hmm, updated to latest.. but it doesn't looks like that fixed it.

@jeffposnick any tips? My config is..

{
  "cacheId": "hpbn",
  "staticFileGlobs": [
    "staging/*.html",
    "staging/*/*.html",
    "staging/assets/**/*",
    "staging/*.json"
  ],
  "stripPrefix": "staging/",
  "runtimeCaching": [],
  "verbose": true
}

Offline navigations to https://hpbn.co/primer-on-latency-and-bandwidth/#speed-is-a-feature are working for me.

It's possible that after deploying the latest service-worker.js and testing again, @igrigorik, you still continued getting the old service-worker.js from the HTTP cache. I noticed you're serving it with

cache-control:public, max-age=7200

If you try again once the HTTP cached version has expired, you should see the correct, updated behavior.

(I'd recommend serving your service-worker.js with HTTP caching disabled; see https://stackoverflow.com/questions/38843970/service-worker-javascript-update-frequency-every-24-hours/38854905#38854905 for more context.)

You're right. I ruled out the cache because I cleared it on the client but did not account for the CDN caching a stale copy. Everything appears to be working correctly with the new SW file in place — yay! Thanks for your help.. again. :-)