Search code examples
javascripthtmlbrowser-cacheprogressive-web-apps

How to stop a PWA from caching my website


I have a simple PWA, that I update and change from Github pages.

When I make an update to the website, It doesn't show on the devices using the website, because (at least I think) its being cached. I don't have any service workers to cache the site.

Even a normal refresh from the website (using all of these)

Doesn't refresh it and shows the changes. On iOS I manually have to go into settings and clear the website data to see the changes.

How can i fix this?


Solution

  • Use Network First (Network Falling Back to Cache)

    https://developers.google.com/web/tools/workbox/modules/workbox-strategies#network_first_network_falling_back_to_cache

    For requests that are updating frequently, the network first strategy is the ideal solution. By default, it will try to fetch the latest response from the network. If the request is successful, it’ll put the response in the cache. If the network fails to return a response, the cached response will be used.