DEV Community

Weather Clock Dash
Weather Clock Dash

Posted on

uBlock Origin: Beyond Basic Ad Blocking (Medium Mode and Dynamic Filtering)

Most people install uBlock Origin and use it in Easy Mode (the default). This is a good choice — the maintained filter lists are comprehensive. But there's a Medium Mode that gives more control.

The Three Filtering Modes

Easy Mode (default): Filter lists do the work. You block from maintained lists (EasyList, EasyPrivacy, uBlock lists). Low maintenance, works well.

Medium Mode: Blocks third-party scripts by default. More breakage, more control, you manage exceptions manually.

Hard Mode: Blocks all third-party content by default. Very aggressive, most sites break, you allow everything explicitly.

Recommendation: Stay in Easy Mode unless you want to actively manage network requests.

What Medium Mode Changes

Third-party scripts are scripts loaded from a domain different than the current page. In Medium Mode, these are blocked by default.

If you visit example.com, scripts from analytics.google.com or CDN hosts are third-party and blocked.

To enable Medium Mode:

  1. uBlock icon → Dashboard (gear icon) → Settings → check "Advanced user"
  2. My Filters panel → add rule: * * 3p-script block

This blocks all third-party JavaScript globally. Sites that depend on CDN-hosted scripts will partially break.

Dynamic Filtering Rules

In advanced mode, the My Rules panel lets you create per-site or global rules:

# Syntax: page-domain source-domain type action
* analytics.google.com * block        # block Google Analytics everywhere
example.com * 3p-script allow         # allow all third-party scripts on example.com
example.com cdn.example.com script allow  # allow a specific CDN script
Enter fullscreen mode Exit fullscreen mode

The * wildcard matches anything. Type 3p means third-party. Actions: block, allow, noop.

Breakage Workflow

When Medium Mode breaks a site:

  1. Click the uBlock icon — it shows blocked domains with counts
  2. Click the slider next to a blocked domain to "temporarily allow"
  3. Test if it fixes the site
  4. If it works, decide: permanent allow or find a more targeted rule

Cosmetic Filtering (Element Hiding)

Beyond network blocking, uBlock can hide elements with CSS:

Right-click an element → "Block element in uBlock Origin" → use the visual picker → create a rule.

Useful for: cookie consent banners, annoying UI elements, ad containers that slip through filters.

These CSS rules hide elements without blocking network requests.

For Developers

Testing without blocking: click uBlock icon → power button → reload. Page loads without any blocking. Good for testing analytics, checking ad appearance.

Blocking specific scripts: Network panel in DevTools → right-click → "Block URL pattern" → simulates script failure.

NightOwl Compatibility with Medium Mode

Dark mode extensions that inject JavaScript into pages can be affected by Medium Mode.

NightOwl uses a CSS filter approach (not JavaScript injection), so it works fine alongside uBlock Medium Mode without requiring exceptions.

NightOwl for Firefox — CSS-only dark mode, compatible with strict uBlock settings.

Tab Sessions During Debugging

When you're testing your site with different uBlock configurations, context switching is common. Tab Manager & Session Saver can save your "uBlock testing" tab set as a named session — your staging URLs, DevTools, reference docs — so you can switch contexts without losing your setup.


Summary: Easy Mode covers most use cases with no configuration. Medium Mode is for users who want fine-grained control over which scripts run. The tradeoff is time spent managing exceptions.

Top comments (0)