ampproject / amp-sw

A drop in service worker library to help your AMP pages gain network resiliency in 1 line
Apache License 2.0
70 stars 29 forks source link

Offline page not working #49

Open sebastianbenz opened 5 years ago

sebastianbenz commented 5 years ago

The offline page is currently not working for amp.dev. Here is our serviceworker:

importScripts('https://cdn.ampproject.org/sw/amp-sw.js');
AMP_SW.init({
  assetCachingOptions: [{
    regexp: /\.(png|jpg|woff2|woff|css|js)/,
    cachingStrategy: 'CACHE_FIRST',
  }],
  offlinePageOptions: {
    url: '/offline.html',
    assets: [],
  },
});

Steps to reproduce:

  1. visit amp.dev
  2. open DevTools and check if sw is installed and /offline.html is cached
  3. Trigger offline mode in DevTools
  4. Reload the page => works
  5. click a link to an uncached page => no offline page is shown
DerekNonGeneric commented 5 years ago

Once implemented, I feel ampproject/amp.dev#589 will have been addressed as a revision of the SW's implementation will have been made. You all have made a lot of progress towards satisfying Lighthouse's PWA criteria since I filed that issue two years ago. Good work! 👍

seomaz commented 4 years ago

@kristoferbaxter Any update on this ?