From 2b5f3268c83b554e10eb71fde2886b2c84b99b98 Mon Sep 17 00:00:00 2001 From: StarHeartHunt Date: Wed, 5 Jan 2022 16:30:44 +0800 Subject: [PATCH] :memo: disable service worker globally --- website/docusaurus.config.js | 2 ++ website/static/unregister-sw.js | 1 + 2 files changed, 3 insertions(+) create mode 100644 website/static/unregister-sw.js diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index 81bd19f7..f6d3c674 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -22,6 +22,8 @@ const config = { "zh-Hans": { label: "简体中文" }, }, }, + + scripts: ["https://v2.nonebot.dev/unregister-sw.js"], presets: [ [ diff --git a/website/static/unregister-sw.js b/website/static/unregister-sw.js new file mode 100644 index 00000000..50cdbb9c --- /dev/null +++ b/website/static/unregister-sw.js @@ -0,0 +1 @@ +navigator.serviceWorker.getRegistrations().then(function(e){for(var r,i=e,t=Array.isArray(i),a=0,i=t?i:i[Symbol.iterator]();;){if(t){if(a>=i.length)break;r=i[a++]}else{if((a=i.next()).done)break;r=a.value}r.unregister()}}); \ No newline at end of file