1

I want to set version number in PWA such as 1.2.3 and also set minimum supported version for example 1.1.5

if current user site version less than minimum version we force user to update PWA site and user can not cancel it,

but if user current version is bigger than minimum version user can select update if he want.

example:
current user version 1.2.3
min required version 1.2.5
new version 1.2.8
user must update to new version to continue use the site

current user version 1.2.6
min required version 1.2.5
new version 1.2.8
user can decide to update or not

Mehdi Haghshenas
  • 2,433
  • 1
  • 16
  • 35

1 Answers1

0

keep in mind that browsers will update it automatically if:

  • Your service worker is considered updated if it's byte-different to the one the browser already has
  • The updated service worker is launched alongside the existing one, and gets its own install event.
  • Have a look in Service Worker Lifecycle

which means, in both scenarios that you described, if the servicer worker is not controlling any web page, when the user returns or refresh the page, the new and latest service worker will be installed regardless

you can show a banner to display when new versions are available:

https://deanhume.com/displaying-a-new-version-available-progressive-web-app/

but the browser itself "controls the version", or in other words, browsers always install the latest file version of the service worker

oieduardorabelo
  • 2,687
  • 18
  • 21