您可以在PWA中手动设置版本号吗?

发布于 2025-01-22 04:51:48 字数 562 浏览 2 评论 0原文

tl; dr

是否可以在subtest.jsonservice> 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小兔几 2025-01-29 04:51:48

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文