@
bingdong700 #9 Service Worker 记忆中是根据硬盘剩余空间按百分比来,好像没太好的能永久一键设置的地方.
我能想到的解决方案就是,写个油猴脚本,注入个脚本,定期取消注册对应网站的 Service Worker .
chatGPT 写的..
```JavaScript
// ==UserScript==
// @
name Disable Service Worker for web.telegram
// @
namespace http://tampermonkey.net/// @
version 1.0
// @
description Disable Service Worker for web.telegram when the website is closed
// @
author Your name
// @
match https://web.telegram.org/*// @
grant none
// ==/UserScript==
// Listen to the beforeunload event when the website is closed
window.addEventListener('beforeunload', function() {
// Get all the registered Service Workers
navigator.serviceWorker.getRegistrations().then(function(registrations) {
// Loop through the registrations and unregister them
for(let registration of registrations) {
registration.unregister();
}
});
});
```