Force App Reload - Forum

Forum Navigation
You need to log in to create posts and topics.

Force App Reload

Forcing new version to be loaded.

When the user has added the application to their phone home screen, clearing their phone browser cache does not show a new version of the application. The only way seems to be to delete the shortcut and re-install a new one to home screen.

Has anyone come up with a way to always show the version of HTML on the location that stores the PWA instead of the user seeing the one in their phone when added to home screen as a link.?

This seems to be a common request elsewhere with PWA.

 

@jason-roberts It's very important don't forget to modify the app version number as it will be reflected in the manifest.webmanifest file. When the browser detects a change in that file it will proceed to download the new version.

However take a look here for more information:
https://stackoverflow.com/questions/49739438/when-and-how-does-a-pwa-update-itself

Regards.

Thank you. Yep I am doing that on update and in a browser its works fine as expected.

The problem is getting the application to show the latest version when on mobile when the user has added the shortcut to home screen. The phone will not refresh to the new version.

If you delete the shortcut and re-access the app from the web page on the phone the new version is there which means you have to add to home screen again a new link.

I am trying to find a way to force the phone to dump its files and refresh from the webpage. I believe this is a service worker issue designed to make the app run faster.

I will look at the link.

This bit is interesting I will try that and add a const.

Only two events…

In essence, there are only two events that will automatically trigger a PWA update:

  1. A change in the linked manifest.json; e.g. a changed icon file or a changed scope or start_url.
  2. A one-character change in the controlling service-worker.js. Hence, if you store the version number in a const in this file and change it, an update of the PWA will be triggered.

When a change is detected, the new version will normally be activated only with the next PWA load. So, in all, two reloads are necessary to see a change.

If anyone has found a way around this I would be very interested as its a regular problem with PWA on mobile.