A Chrome extension that blocks unwanted content on websites using two powerful methods: DOM element removal and network-level blocking.
- Specify DOM elements to remove or hide per website
- Hide mode: Apply
display: none !importantstyle (element stays in DOM) - Remove mode: Completely remove element from DOM
- Support for both CSS selectors and XPath
- Interactive element picker with keyboard navigation
- Automatically remove/hide dynamically added elements (MutationObserver)
- Manage and save rules per site
- Block network requests before they load (like AdBlock)
- Automatic URL pattern expansion (e.g.,
ads.comβ 4 blocking patterns) - Extract URLs from page elements with element picker
- Filter by resource type (images, scripts, CSS, XHR, iframes)
- Powered by Chrome's declarativeNetRequest API
- Export: Save all rules to JSON file (πΎ button)
- Import: Restore rules from JSON file (π₯ button)
- Backup and share your filtering rules across devices
- Version-tagged export files with timestamps
- Navigate to
chrome://extensions/in Chrome browser - Enable "Developer mode" in the top right corner
- Click "Load unpacked"
- Select this project folder
The extension has two tabs: "μμ μ κ±°" (Element Removal) and "λ€νΈμν¬ μ°¨λ¨" (Network Blocking).
- Visit the desired website (e.g., github.com)
- Click the extension icon
- Select selector type:
- CSS Selector:
#logo,.ads,div.header - XPath:
//*[@id="logo"],//div[@class="ads"]
- CSS Selector:
- Enter the selector and click "Add"
- The page will automatically reload and apply the rule (default: remove)
- After adding a rule, use the radio buttons in each rule item:
- μ¨κΉ (Hide): Apply
display: none !important- element stays in DOM but invisible - μμ (Remove): Completely remove element from DOM
- μ¨κΉ (Hide): Apply
- The page automatically reloads when you change the action mode
- Click the extension icon
- Click the π― button
- Hover over elements on the page to preview selection
- Use arrow keys to navigate:
- β (Arrow Up): Select parent element
- β (Arrow Down): Select child element
- ESC: Cancel selection
- Click to select the element
- The XPath will be automatically filled in the popup
- Switch to the "λ€νΈμν¬ μ°¨λ¨" tab
- Enter a domain (e.g.,
ads.google.com) - Select resource types to block (all checked by default)
- Click "Add"
- The extension automatically creates 4 blocking patterns:
*://ads.google.com*://*.ads.google.com*://ads.google.com/**://*.ads.google.com/*
- Click the π― button in the "λ€νΈμν¬ μ°¨λ¨" tab
- Click on an image, iframe, or script element on the page
- The URL will be automatically extracted and filled in
- Click "Add" to block that resource
- Click the ποΈ (trash icon) button next to any saved rule in either tab
-
Export Settings:
- Click the πΎ button in the top-right corner
- Downloads a JSON file:
sfw-settings-YYYY-MM-DD.json - Contains all DOM and Network rules from all sites
-
Import Settings:
- Click the π₯ button in the top-right corner
- Select a previously exported JSON file
- Confirm to overwrite current settings
- All rules will be restored and applied immediately
- Tab: μμ μ κ±°
- Type: CSS Selector
- Selector:
#logo
- Tab: μμ μ κ±°
- Type: XPath
- Selector:
//*[@id="mat-expansion-panel-header-288"]/span[1]/mat-panel-title/div/div/div[1]
- Tab: λ€νΈμν¬ μ°¨λ¨
- URL Pattern:
doubleclick.net(auto-expands to 4 patterns) - Resource Types: All (default)
- Result: Blocks all requests to
*.doubleclick.net
- Tab: λ€νΈμν¬ μ°¨λ¨
- URL Pattern:
ads.example.com - Resource Types: Image only
- Result: Blocks image requests from ad server
Rules are stored in chrome.storage.sync and synced across your Google account.
{
"sfwRules": {
"github.com": [
{ "type": "css", "selector": "#logo", "action": "remove" },
{ "type": "xpath", "selector": "//*[@id='something']", "action": "hide" }
],
"example.com": [
{ "type": "css", "selector": ".ads", "action": "remove" }
]
}
}action:"hide"(display:none) or"remove"(delete from DOM)- Default:
"remove"
{
"sfwNetworkRules": [
{
"urlPattern": "*://ads.google.com",
"resourceTypes": ["image", "script", "stylesheet", "xmlhttprequest", "sub_frame"]
},
{
"urlPattern": "*://*.ads.google.com/*",
"resourceTypes": ["image", "script", "stylesheet", "xmlhttprequest", "sub_frame"]
}
]
}Network blocking rules are applied globally using Chrome's declarativeNetRequest API.
{
"version": "1.0",
"exportDate": "2025-10-10T12:34:56.789Z",
"domRules": { /* sfwRules object */ },
"networkRules": [ /* sfwNetworkRules array */ ]
}sfw/
βββ manifest.json # Extension configuration
βββ content.js # Element picker + DOM removal + URL extraction
βββ popup.html # Popup UI with tabs
βββ popup.css # Popup styles
βββ popup.js # Popup logic + network blocking
βββ picker.css # Element picker visual styles
βββ icons/ # Icon files
βββ icon16.svg
βββ icon48.svg
βββ icon128.svg
- Manifest V3
- Vanilla JavaScript
- Chrome Extension APIs
chrome.storage.sync- Rule persistencechrome.storage.local- Temporary picker datachrome.tabs- Tab controlchrome.declarativeNetRequest- Network blocking- Content Scripts
- MutationObserver API - Dynamic element removal
- DOM APIs - Element selection and manipulation
| Feature | SFW | AdBlock |
|---|---|---|
| Blocking Method | DOM removal + Network blocking | Network blocking only |
| Timing | After page load (DOM) / Before request (Network) | Before request |
| Target | User-selected elements + URLs | Filter list subscriptions |
| Customization | Full control per element/URL | Limited per-site control |
| Use Case | Remove any page element + block ads | Block ads only |
MIT