首页 > 解决方案 > Service Worker 错误“未捕获(承诺)DOMException:超出配额。”

问题描述

我正在尝试构建一个 PWA 应用程序。该应用程序在其他设备和机器浏览器上运行,但在我的 Chrome 浏览器中,我的浏览器出现以下错误。

Uncaught (in promise) DOMException: Quota exceeded.           service-worker.js:1

服务工作者文件:

/**
 * Welcome to your Workbox-powered service worker!
 *
 * You'll need to register this file in your web app and you should
 * disable HTTP caching for this file too.
 * See https://goo(dot)gl/nhQhGp
 *
 * The rest of the code is auto-generated. Please don't update this file
 * directly; instead, make changes to your Workbox build configuration
 * and re-run your build process.
 * See https://goo(dot)gl/2aRDsh
 */

importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");

importScripts(
  "/mywebpage/precache-manifest.js"
);

self.addEventListener('message', (event) => {
  if (event.data && event.data.type === 'SKIP_WAITING') {
    self.skipWaiting();
  }
});

workbox.core.clientsClaim();

/**
 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
 * requests for URLs in the manifest.
 * See https://goo(dot)gl/S9QRab
 */
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/mywebpage/index.html"), {

  blacklist: [/^\/_/,/\/[^\/?]+\.[^\/]+$/],
});

标签: javascriptgoogle-chromeservice-worker

解决方案


推荐阅读