Adblock Plus and (a little) more

New filter type option for WebSockets · 2016-09-21 14:30 by Wladimir Palant

Starting with Adblock Plus 1.12.2 for Chrome, Opera and Safari we can block connections initiated via WebSockets on all major platforms (this functionality was available on Firefox since the very start). However, we didn’t have a special type for these requests as these were listed with type “other” instead. The assumption was that the protocol ws:// or wss:// would be sufficient for filter list authors in order to target WebSocket connections specifically. However, we received feedback that this wasn’t the case.

So with the current development builds (Adblock Plus 2.7.3.4202 for Firefox and Adblock Plus 1.12.2.1655 for Google Chrome, Opera and Safari) WebSocket connections are listed with the new type “websocket.” Consequently, filters can be made to target such connections specifically by adding $websocket type option. Existing filters will have to be duplicated for now:

something$websocket
something$other

This syntax will support both new and old Adblock Plus versions as long as the versions without support for the “websocket” type are still common (these will ignore the first filter).

To the install page

Edit (2016-09-22): This post was originally suggesting specifying both websocket and other options on one filter. This approach will not work in Adblock Plus versions without support for the websocket option because filters with unknown options are ignored.

Tags:

Comment [2]

  1. gear23 · 2016-09-24 03:09 · #

    Was $other option previously meant only for WebSocket connections or did it cover anything else?

    Reply from Wladimir Palant:

    The $other option covers a few other types as well, these aren’t really common on the web however.

  2. gear23 · 2016-09-24 09:55 · #

    Does this mean $other will continue to be a valid filter option going forward? What are the other types covered by $other option?

    Reply from Wladimir Palant:

    Yes, it is still a valid option of course, it covers all types without a dedicated type option. Currently that is REFRESH (technically this is defined but Adblock Plus should never get this one), XBL (unlikely to be seen on the web because only privileged code can use this now), DTD (same here, regular webpages cannot load DTD files), CSP_REPORT (I don’t think that Adblock Plus associates these with the website), XSLT (very rare) and WEB_MANIFEST (note entirely sure what that is).

Commenting is closed for this article.