PWA Refresh

Hi,

When the source has changed on the server how do you get the PWA app to update on iOS. Refreshing in safari works but the home screen link remains unchanged.

Thanks,

Ken

Normally, when iOS is online and the files of the PWA have been updated, the serviceworker should see that the timestamp on the files has changed and should automatically update them. Unless, there is somewhere intermediate caching happening like in a router or ISP.
It is an automatic mechanism handled by the serviceworker where we have little influence.

Thanks, this doesn't appear to be working but I will monitor it in case it is delayed somehow.

I cannot get this to work at all on iOS. Are there any additional settings that I need to complete?

I can't get it to work on Android properly either. I know it is a valid PWA as far as Android is concerned as it is opening in it's own box. Does any change need to be made to ServiceWorker.js which only seems to be fetching text/html files?

The serviceworker.js as-is should have all your project files listed for caching by default.
I'd rather check server side if your server can properly return file timestamp info.

Is this done via my .htaccess file? If so do I have to put anything in specifically for the serviceworker? If not what else?

I assume you use IIS.
If so, here is some background info on cache control

No, my web server is apache.

I'm sorry, I'm not an expert with Apache server.
I suggest to look at Apache cache control.

Thanks anyway. I will post a solution here when I find one.

I believe that there may be a mistake in the ServiceWorker.js that is generated. The fetch is currently:

self.addEventListener('fetch',function(event) {
event.respondWith(
fetch(event.request).catch(function() {
return caches.match(event.request).then(function(response) {
if (response) {
return response;
} else if (event.request.headers.get("accept").includes("text/html")) {
return caches.match("index.html");
}
});
})
);
});

When "inedex.html" is changed to event.request all works as expected.

Can I please have a response to the last post?

If your app updates, update the apps entry point, i.e. the HTML file.