Michal Przybylowicz
Michal Przybylowicz

Reputation: 1668

How can I prevent Service Workers from being installed in Chrome browser?

I would like to block selected websites from being able to install service workers or disable the ability to install service workers at all.

How can I do that ?

Upvotes: 8

Views: 7844

Answers (3)

alec
alec

Reputation: 121

You can disable Service Workers through Content Security Policies. According to the details on this website, you can use uBlock Origin for this.

A snip from the page:

Extensions like uBlock can use Content Security Policy(CSP) fetch directives to filter and block SWs. Just add the following line on uBlock’s “My filters”:

||$csp=worker-src 'none'

Upvotes: 2

Davor
Davor

Reputation: 319

You can unregister/delete them by visiting chrome://serviceworker-internals/

But, the only way I fount to block them is to block javascript in general in your browser. That prevents you from using some web apps but if you are doing it for privacy concerns this is the best way to not give info about your visit.

Upvotes: -1

Thomas
Thomas

Reputation: 2546

In Chrome there is no built-in flag to disable service workers specifically. But service workers count as "cookies/site data" at chrome://settings/cookies so blocking those disables service worker.

Source: https://groups.google.com/a/chromium.org/forum/#!topic/service-worker-discuss/Cohd-TKG8so

Upvotes: 5

Related Questions