Greasy Fork is available in English.

Block Service Workers

Blocks Service Worker's registration.

Stan na 03-10-2023. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Block Service Workers
// @name:zh-CN  禁用Service Workers
// @namespace   Violentmonkey Scripts
// @match       *://*/*
// @unwrap
// @version     0.2
// @author      axototl
// @inject-into page
// @sandbox     JavaScript
// @license     AGPL-3.0-or-later
// @description Blocks Service Worker's registration.
// @description:zh-CN 阻止Service Worker,并移除现有的Service Worker,杜绝网上垃圾。
// @run-at      document-start
// ==/UserScript==

(() => {
    'use strict';
    if (!('serviceWorker' in navigator)) return;
    console.log("Removing Service Workers API, please wait...");
    navigator.serviceWorker.register = () => new Promise((res, rej) => rej("This method is not allowed!"));
    console.log("Deregistering Installed Service Workers, please wait...");
    (async () => {
        let arrs = await navigator.serviceWorker.getRegistrations();
        for (const it of arrs) it.unregister();
    })();
    console.log("All done!");
    // GM_registerMenuCommand("注销Service Workers", logout);
})();