服务人员无法在Chrome中以离线模式工作

时间:2019-04-20 00:43:16

标签: angular google-chrome caching service-worker

我是angular / Angular CLI的新手,我从服务工作者入手

我尝试使用本教程: https://angular.io/guide/service-worker-getting-started

还有另一个教程,用于使用angularCli创建应用程序,该应用程序具有服务人员的所有文件

1)例如,我的应用程序名称为“ ServiceWorker”

2)制作“ ng build- --prod”

3)并在“ http-server -p 8080 -c-1 dist / ServiceWorker”之后

4)应用程序启动到“ http://192.168.1.14:8080”或“ http://127.0.0.1:8080

但是第一个问题是我的缓存为空....这对于离线工作的应用程序来说是个问题

Cache Storage empty

当我激活离线模式后,我就拥有了

error internet

有人可以解决吗? 我不明白为什么我的缓存一直都是空的! 我在manifest.json

上尝试
CustomScrollView(
      slivers: <Widget>[
        SliverAppBar(
          expandedHeight: 100.0,
          floating: true,
          snap: true,
          backgroundColor: Colors.green,
          elevation: 0.0,
          flexibleSpace: FlexibleSpaceBar(
            title: const Text(
              "test",
              style: TextStyle(color: Colors.white, fontSize: 20.0),
            ),
            centerTitle: true,
            background: Column(
              mainAxisAlignment: MainAxisAlignment.end,
              children: <Widget>[
                Stack(
                  children: <Widget>[
                    Container(
                      height: 60.0,
                      color: Colors.black,
                    )
                  ],
                )
              ],
            )
          ),
        SliverFillRemaining(
          child: new Text("data"),
        )
      ],
    ),

我尝试更改

 "offline_enabled": true,

start_url" :"/"

在我的网址192.168.1.14:8080上,我尝试添加/index.html或/或不添加任何内容...这是相同的

有人可以解决吗? 我看不到有人有这个问题 非常感谢 约安

0 个答案:

没有答案