'Can you manually set the version number in a PWA?
TL;DR
Is there a way to set the version number of a PWA (Progressive Web Application) in the manifest.json
or service-worker.js
file to override the default (1
) to a custom number?
I've already tried adding a version
key in manifest.json
, but the version number stayed at 1
.
{
"version": 2
}
I've also tried to add a version
variable in service-worker.js
, like so. However, that didn't set the version correctly either.
const version = 2;
// Also tried...
const VERSION = 2;
So, is it possible to set the version number in a PWA?
Solution 1:[1]
An id
field was added to the Web App Manifest spec in late 2021. Chrome implemented it in version 96.
I don't think anyone else has implemented this yet, but I believe you can get a similar effect with query parameters in the start_url
.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Arnav Thorat |