While uBlock Origin (uBO) is primarily designed to block known trackers, ads, and malicious content before they load, it does not have a built-in feature to block all network requests after a page has loaded.
However, you can still achieve this functionality through a combination of uBlock Origin's advanced features and custom filters. Here's a step-by-step guide on how to configure uBlock Origin to block all network requests after the initial page load.
Step-by-Step Guide:
Step 1: Install uBlock Origin
If you haven't already, install uBlock Origin from your browser's extension store:
Step 2: Open uBlock Origin Dashboard
Click on the uBlock Origin icon in your browser's toolbar to open the dashboard.
Step 3: Navigate to the "My filters" Tab
- In the uBlock Origin dashboard, click on the "gear" icon to go to the settings.
- Select the "My filters" tab. This is where you can add custom filters.
Step 4: Add Custom Filters to Block Network Requests
To block all network requests after the page has loaded, you need to add custom filters that target all outgoing requests. Add the following lines to the "My filters" text area:
||*$network=block
Explanation:
||* matches all domains.
$network=block blocks all network requests.
Step 5: Apply the Filters
After adding the custom filter, click the “Apply changes” button at the bottom of the settings panel.
Step 6: Whitelist Initial Page Load (Optional but Recommended)
Blocking all network requests will prevent the page from loading any additional resources, including images, scripts, and stylesheets, making the site unusable. To allow the initial page load but block subsequent requests, you need to create an exception for the initial load. Unfortunately, uBlock Origin does not have a built-in way to differentiate between initial and subsequent requests.
However, you can manually allow necessary resources to load initially and then block further requests. This requires a more granular approach and might need tweaking for each site.
-
Allow Initial Resources:
Identify the essential resources needed for the initial page load. You can do this by:
- Loading the page.
- Opening the Developer Tools (F12).
- Going to the Network tab.
- Noting down the URLs of the essential resources (HTML, main CSS, main JS files).
-
Whitelist These Resources in uBlock Origin:
In the "My filters" tab, whitelist these essential resources by adding them with the ||$allow directive. For example:
||example.com^$allow
||example.com/main.css^$allow
||example.com/main.js^$allow
-
Block All Other Requests:
After whitelisting the essential resources, add the block rule for all other requests.
||*$network=block
Step 7: Test the Configuration
- Reload the webpage to see if the initial resources load correctly.
- Open the Developer Tools and go to the Network tab to verify that no further network requests are being made after the initial load.
Important Notes:
- Usability Trade-Offs: Blocking all network requests after the initial load will break many modern websites that rely on dynamic content loading, single-page applications, and asynchronous data fetching. Use this configuration judiciously.
- Site-Specific Configuration: For different websites, you may need to adjust the whitelisted resources. This method is more suitable for static pages where you know exactly which resources are needed for the initial load.
- Alternative Approach: Instead of blocking all network requests, consider using uBlock Origin's default lists and adding specific filters to block known tracking domains. This approach maintains site functionality while enhancing privacy
### Block known trackers
||analytics.google.com^
||hotjar.com^
||clarity.ms^
By following these steps, you can configure uBlock Origin to block all network requests after the initial page load, though with significant limitations on site functionality. For most use cases, selectively blocking known trackers is a more practical solution.