您可以在PWA中手动设置版本号吗?
tl; dr
是否可以在subtest.json
或service> service-worker.js 文件将默认值(
1
)覆盖为自定义号码?
我已经尝试在subtest.json
中添加版本
键,但是版本号停留在1
。
{
"version": 2
}
我还尝试在service-worker.js
中添加版本
变量。但是,这也没有正确设置版本。
const version = 2;
// Also tried...
const VERSION = 2;
那么,是否可以在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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
id
字段已添加到 Web App Subtest Spec < /a>在2021年底。Chrome在我认为其他人还没有实施此功能,但是我相信您可以使用
start_url
中的查询参数获得类似的效果。这是一篇文章,可以进一步解释。
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
.Here's an article that explains further.