Simple URL Blocker icon

Simple URL Blocker

by romikette

v1.0 Updated Mar 6, 2025 3.91KiB
CWS
17
Users
★ 0.00
0 reviews
#105689
of 207.3K
developer
#8949 of 18.1K
⚠️Not updated in over a year

Description

Overview Simple URL Blocker is a Chrome extension designed to control web access by intercepting and modifying network requests using declarative rules. It operates as a service worker-driven extension, leveraging Chrome’s declarativeNetRequest API to enforce domain- and route-specific blocking based on dynamically stored configurations. The extension does not inject scripts or modify page content but instead blocks URLs at the request level, ensuring minimal performance impact. It uses chrome.storage.local to persist blocking rules across sessions and updates them dynamically as users modify the block list. Technical Architecture Blocking Mechanism Blocking is achieved through chrome.declarativeNetRequest.updateDynamicRules(), which modifies request handling dynamically. The process follows these steps: User-defined blocked domains and routes are retrieved from chrome.storage.local. The service worker listens for changes and updates blocking rules dynamically. If a request matches a blocked pattern, it is intercepted and redirected (e.g., to Google). Changes apply instantly without requiring a restart. The extension strictly adheres to Chrome security policies by avoiding content scripts or direct DOM manipulation. Declarative Rule Management The extension structures blocking rules as follows: Example: Blocking an entire domain { "id": 1, "priority": 1, "action": { "type": "redirect", "redirect": { "url": "https://www.google.com" } }, "condition": { "urlFilter": "*://example.com/*", "resourceTypes": ["main_frame"] } } This rule blocks all pages on example.com. Example: Blocking a specific route on a domain { "id": 2, "priority": 1, "action": { "type": "redirect", "redirect": { "url": "https://www.google.com" } }, "condition": { "urlFilter": "*://example.com/*/blocked-route/*", "resourceTypes": ["main_frame"] } } This rule blocks only URLs containing /blocked-route/ on example.com. Rules persist across sessions and update dynamically based on user configurations. Storage & Rule Synchronization Blocking rules are managed asynchronously via the Chrome Extensions API: Writing blocked domains/routes to storage: chrome.storage.local.set({ blockedRoutes: [{ domain: "example.com", route: "/blocked-route" }] }); Retrieving stored block lists: chrome.storage.local.get("blockedRoutes", (data) => { console.log(data.blockedRoutes); }); Listening for configuration changes: chrome.storage.onChanged.addListener((changes) => { if (changes.blockedRoutes) { updateBlockingRules(changes.blockedRoutes.newValue); } }); Service Worker Execution The service worker manages enforcement and ensures minimal background execution to comply with Chrome’s extension policies. It: Loads stored blocking rules when activated. Monitors storage changes and updates rules in real time. Avoids unnecessary execution time to remain efficient. Privacy & Compliance No Remote Code Execution: The extension does not fetch or execute remote scripts. Local Storage Only: Block lists remain on the user’s local device. No Data Collection: The extension does not track or transmit browsing activity. By providing a robust, lightweight request-filtering approach, Simple URL Blocker offers an efficient and policy-compliant way to manage restricted content in Chrome.
Simple URL Blocker screenshot 1Simple URL Blocker screenshot 2Simple URL Blocker screenshot 3Simple URL Blocker screenshot 4

Reviews

Loading reviews...

Permissions (2)

Permissions

declarativeNetRequest Can block or redirect network requests storage Can store data locally in your browser

Details

Version 1.0
Updated Mar 6, 2025
Size 3.91KiB
First Seen Mar 28, 2026