From 91edb35780a890da675624ed1b163cd39ce8379c Mon Sep 17 00:00:00 2001 From: nonameShijian <2954700422@qq.com> Date: Fri, 17 May 2024 21:56:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Durl=E5=B8=A6=E6=9C=89?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=90=8D=E6=97=B6serviceWorker=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/game.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/game.js b/game/game.js index 9713ff8e7..32023b1b7 100644 --- a/game/game.js +++ b/game/game.js @@ -134,7 +134,7 @@ // 使serviceWorker加载完成后,再加载entry.js if (location.protocol.startsWith("http") && "serviceWorker" in navigator) { - let scope = window.location.protocol + "//" + window.location.host + window.location.pathname; + let scope = (new URL("./", location.href)).toString(); let registrations = await navigator.serviceWorker.getRegistrations(); let findServiceWorker = registrations.find(registration => { return registration && registration.active && registration.active.scriptURL == `${scope}service-worker.js`;