Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Chrome DevTools Protocol’s Network domain before navigation. In chromedp, call network.SetBlockedURLs with URL patterns for stylesheets and image extensions, then navigate. This prevents matching requests from loading. If you must classify requests by browser resource type rather than filename, use the Fetch domain and explicitly fail paused requests.

Choose the blocking method

Method Matches Best for Important limitation
Network.setBlockedURLs via network.SetBlockedURLs URL patterns A short list of predictable CSS and image URLs A URL can omit its file type; ordered allow and block patterns affect the result.
Fetch.enable via the generated Fetch API URL pattern and, where supported, resource type Per-request decisions or filtering by browser classification Matching requests pause until your handler continues or fails them. An incomplete handler can leave page loads pending.

Start with Network blocking when extensions such as .css, .png and .webp are reliable indicators. Move to Fetch when URLs are opaque, resources are generated dynamically, or you need a decision for each request.

Prerequisites and version checks

  • A Go module using github.com/chromedp/chromedp and its generated github.com/chromedp/cdproto package.
  • A Chrome or Chromium binary compatible with the CDP version used by your pinned cdproto module.
  • A target context created by chromedp. Apply the blocking command to that target before calling chromedp.Navigate.

The generated API and enum names can change with module versions. Check the exact cdproto version in your go.mod and the browser version deployed by your application before copying a snippet into production.

Block CSS and common image extensions with Network.setBlockedURLs

Complete Go example

This example creates a browser context, installs URL rules, navigates, waits for the body, and captures a screenshot. The regular-expression-like backslashes shown in the patterns are part of the CDP URL-pattern syntax; verify escaping against your pinned generated package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Magicmoon 2-Pack 24 Inch Computer Privacy Screen Filter for 16:9 Monitor
  • Compatible Model(s): Magicmoon brand filter only for 24 inch -diagonally measured - widescreen monitor - aspect ratio 16:9 - filter size: width: 20 15/16", Height: 11 13/16" (531mm x 298mm)
  • Superior Privacy: The computer privacy filter makes the screen appear dark when looking at it from an angle (the angle is about 30 to 60 degree), but bright when looking directly at it. To change the privacy level - simply adjust your monitor’s brightness accordingly
  • Eye and Screen Protection: Privacy Filter does not only protect your private life but also protects your eyes by blocking 30% of blue light , blocking the harmful blue light between 380 to 495 nm, it filters out the blue light and relieves eye strain
  • Perfect For Open Workspaces: Great for maintaining screen privacy in open work spaces
  • Includes Two Options: Option 1 uses clear adhesive strips that securely attach to any computer screen. Option 2 (for computer screens with a raised bezel only) uses slide mount tabs that easily stick to the display frame, allowing you to slide the privacy screen filter on and off as needed
package main

import (
    "context"
    "log"
    "time"

    "github.com/chromedp/cdproto/network"
    "github.com/chromedp/chromedp"
)

func main() {
    ctx, cancel := chromedp.NewContext(context.Background())
    defer cancel()

    ctx, cancel = context.WithTimeout(ctx, 45*time.Second)
    defer cancel()

    patterns := []*network.BlockPattern{
        {URLPattern: "*://*/*\.css*", Block: true},
        {URLPattern: "*://*/*\.png*", Block: true},
        {URLPattern: "*://*/*\.jpg*", Block: true},
        {URLPattern: "*://*/*\.jpeg*", Block: true},
        {URLPattern: "*://*/*\.webp*", Block: true},
        {URLPattern: "*://*/*\.gif*", Block: true},
    }

    err := chromedp.Run(ctx,
        chromedp.ActionFunc(func(ctx context.Context) error {
            return network.SetBlockedURLs().
                WithURLPatterns(patterns).
                Do(ctx)
        }),
        chromedp.Navigate("https://example.com"),
        chromedp.WaitVisible("body", chromedp.ByQuery),
        chromedp.CaptureScreenshot(nil, nil),
    )
    if err != nil {
        log.Fatal(err)
    }
}

Replace the final screenshot action with your own extraction or save action. The key ordering is the Network command first and navigation second. Installing rules after navigation can allow early CSS or image requests to complete before the filter exists.

Pattern details

  • The patterns above target URLs containing the listed suffixes. A query string after the extension is still covered by the trailing wildcard.
  • Add other extensions used by your site, such as .svg or .avif, only when you intentionally want those resources blocked.
  • URL blocking is not MIME-type inspection. An image served from /asset?id=42 will not match an extension rule.
  • Rules are ordered. A matching allow pattern (Block: false) can permit a URL even when another rule would block it, so review overlapping rules carefully.

Allow one exception

If a page needs one stylesheet but you want to block other CSS, add an allow pattern for that URL according to the generated API’s ordering semantics, then add the broader block pattern. Test the exact order with your module and browser; do not assume a different CDP release resolves overlaps identically.

Filter by resource type with Fetch

Fetch interception is appropriate when the URL does not reveal whether a request is CSS or an image. Enable request patterns that include the URL pattern and the browser resource type, listen for paused requests, and fail only the matches you want to suppress. Continue every other paused request.

Rank #2
[2 Pack] 24 Inch Computer Privacy Screen Filter for 16:9 Widescreen Monitor
  • 【24 PRIVACY FILTER DIMENSIONS】 Width: 20 15/16" (20.9 inches/532 mm), Height: 11 13/16" (11.8 inches/299 mm) - 16:9 Aspect Ratio. Mamol computer privacy filters are designed to be perfectly compatible with HP, Samsung, Dell, Lenovo, Acer, Asus, LG, ViewSonic and other brands of monitors. Please check the width and height dimensions of your computer screen before ordering. If you have any questions about the dimensions, please contact us.
  • 【ENHANCED PRIVACY PROTECTION】Mamol 24 inch computer privacy filter keeps your electronic information confidential, making it excellent for use in high traffic areas. the computer privacy screen 24 inch is designed with advanced microlouver technology to block visibility at around 30 degrees and black out screens completely near 60 degrees.
  • 【EYES PROTECTION】 This blackout privacy screen greatly reduces eye strain and minimizes potential hazards to vision. It filters 99.9% of UV rays and suppresses 98% of blue light. As a reversible 24-inch privacy screen filter: The glossy side of the protector provides extra clarity and greater privacy, and the matte side minimizes glare and distracting reflections. Satisfy your different daily uses as needed.
  • 【BETTER HD CLARTIY】Mamol 24 inch computer privacy screen Shield adds an extra layer of AR Ultra HD light transmission compared to others. It maintains the high definition of the screen without sacrificing too much screen brightness. It won't reduce the brightness and cause eye fatigue because of the privacy screen installed on the screen.
  • 【ANTI SCRATCH & WASHABLE 】Our privacy anti-glare Monitor film has a surface enhancement layer to protect the privacy filter from scratches and fingerprints. It is washable and reusable. Even after prolonged use, you will get a brand new privacy screen for your desktop computer monitor after cleaning. Very Durable!
// Illustrative structure: confirm Fetch type and method names in your pinned cdproto.
patterns := []*fetch.RequestPattern{
    {URLPattern: "*", ResourceType: network.ResourceTypeStylesheet, RequestStage: fetch.RequestStageRequest},
    {URLPattern: "*", ResourceType: network.ResourceTypeImage, RequestStage: fetch.RequestStageRequest},
}

err := chromedp.Run(ctx, chromedp.ActionFunc(func(ctx context.Context) error {
    return fetch.Enable().WithPatterns(patterns).Do(ctx)
}))
if err != nil {
    return err
}

chromedp.ListenTarget(ctx, func(ev interface{}) {
    paused, ok := ev.(*fetch.EventRequestPaused)
    if !ok {
        return
    }

    // Decide from paused.ResourceType (or your own URL rules).
    if paused.ResourceType == network.ResourceTypeStylesheet ||
        paused.ResourceType == network.ResourceTypeImage {
        go func() {
            _ = chromedp.Run(ctx, fetch.FailRequest(paused.RequestID, network.ErrorReasonBlockedByClient))
        }()
        return
    }

    go func() {
        _ = chromedp.Run(ctx, fetch.ContinueRequest(paused.RequestID))
    }()
})

The exact generated names for ResourceType, request stages, events, and failure reasons vary by cdproto version. Treat this as the implementation shape: enable Fetch, handle every paused event, fail CSS and image requests, and continue all others. Register the listener early enough that requests cannot accumulate before a handler is attached.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why an unhandled paused request is dangerous

Fetch patterns pause matching requests until the client responds. If your listener panics, exits, or ignores an event, the browser can wait indefinitely. Use a context deadline, log handler errors, and make the default branch continue requests. Keep the handler lightweight; perform slow work outside the event callback and preserve the request ID.

Verify that requests were actually blocked

Observe network events

Use chromedp network events or Chrome DevTools’ Network panel to inspect the request outcome. Reload a test page after installing the rules and look for the stylesheet and image requests. DevTools’ request-blocking workflow demonstrates the visible effect: blocking a stylesheet changes page styling.

Rank #3
SightPro 24 Inch 16:9 Computer Privacy Screen Filter for Monitor - Privacy Shield and Anti-Glare Protector
  • 【Privacy Filter Dimensions】- Width: 20 15/16" (532 mm), Height: 11 13/16" (299 mm), Diagonal: 24" (609.6 mm) - SightPro Blackout Privacy Screen Filter is engineered to be compatible with HP, Dell, Samsung, Lenovo, LG, Acer, ASUS, ViewSonic, and other monitor brands. Please verify your computer screen's width and height measurements before ordering. It's not recommended to make your selection based solely on your computer screen's diagonal size.
  • 【Two Attachment Options】- Installs in minutes. Option 1 uses clear adhesive strips that securely attach to any computer screen. Option 2 (for computer screens with a raised bezel only) uses slide mount tabs that easily stick to the display frame, allowing you to slide the privacy screen filter on and off as needed.
  • 【Superior Privacy and Anti Glare】- Our advanced multi-layered film filter blacks out your computer screen when viewing from the side, while maintaining a crystal clear screen straight-on. It also protects your eyes from harmful glare, UV, and blue light. [Note: It does not block visibility directly behind you, regardless of the distance.]
  • 【Perfect for Travel and Open Workspaces】- Our computer screen privacy filter is the ideal solution for healthcare providers, mobile workers, commuters, students, and business travelers. Now you can stay compliant and safeguard sensitive corporate information while working in airplanes, subways, airports and public areas.
  • 【Package Contents】- Each package includes one privacy screen shield filter, two sets of clear adhesive strips, two sets of slide mount tabs, and a microfiber cleaning cloth. Buy with confidence – located in the US, Sight Pro specializes in providing best-in-class privacy solutions to individuals, small businesses, corporations, government, and educational institutions. Our privacy screens are Section 889 and TAA compliant.

Use a controlled test page

  1. Host a page that references a known external stylesheet and a known image URL.
  2. Run the Network-blocking program with those exact patterns.
  3. Record request events and confirm the URLs are marked blocked or failed.
  4. Compare the page with and without the rules, checking both layout and network records.

Do not use the final screenshot alone as proof. A page can contain an inline image, a data URL, a cached element, or JavaScript fallback. A documented chromedp issue shows that a page may substitute a hard-coded image after an external image request fails, so an image remaining visible does not prove that its network request was allowed.

Common problems and fixes

CSS still loads

  • Cause: the stylesheet URL has no .css suffix, is embedded in HTML, or was already loaded before rules were installed.
  • Fix: install blocking before navigation, inspect the actual request URL, add a precise pattern, or use Fetch resource-type filtering.

Some image formats remain

  • Cause: the site uses SVG, AVIF, data URLs, CSS background images, or extensionless endpoints.
  • Fix: add the formats you intend to block, inspect request URLs, and use Fetch when classification is more reliable than suffix matching.

The page hangs with Fetch enabled

  • Cause: a paused request was never continued or failed.
  • Fix: handle every EventRequestPaused, continue non-target requests, and add a timeout so the job terminates instead of waiting forever.

The code does not compile

  • Cause: generated cdproto APIs, enum constants, or method signatures differ from the example.
  • Fix: inspect the package version selected by go list -m, read the generated Network and Fetch declarations, and adjust names to that version. Keep chromedp, cdproto, and Chrome versions aligned.

An image is visible despite blocking

  • Cause: inline data, cache, a fallback, or an alternate request supplied the pixels.
  • Fix: inspect all requests and page source; verify the specific URL you intended to block rather than judging the screenshot.

Performance, reliability, and operational notes

What blocking changes

Blocking requests reduces the resources the browser has to download and prevents CSS from affecting presentation. It does not guarantee a faster job: JavaScript, fonts, API calls, service workers, redirects, and server-side delays can still dominate navigation. No general bandwidth or speed percentage should be assumed; measure your own pages.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Cache and repeated runs

Run verification with a controlled cache state. A resource served from cache may not create the network activity you expect on a second run. Compare a clean context with a repeated navigation and record events in both cases.

Rank #4
Peslv 2-Pack 24 Inch 16:9 Computer Monitor Privacy Screen, WxH:532 * 299mm
  • 【PRIVACY FILTER DIMENSIONS】- Width: 20 15/16" (532 mm), Height: 11 13/16" (299 mm), Diagonal: 24" (609.6 mm) - Peslv Dark 24 inch Privacy Screen Filter is engineered to be compatible with 24in Dell, HP, Samsung, Lenovo, LG, Acer, ASUS, Toshiba, ViewSonic, Aoc, Sceptre, PHILIPS, ViewSonic and other brands monitors with 16:9 aspect ratio. Please verify your computer screen's width and height measurements before ordering. It is not recommended to select a size based solely on the diagonal.
  • 【HIGH-CLASS PRIVACY ABLE】Peslv collected suggestions from more than 2000 computer users and performed 22188 anti-peep angle corrections on the micro-blind optical technology to ensure that any line of sight beyond +-30° facing the screen will be shielded. With a Peslv computer privacy screen 24 inch, Protect the privacy of your computer monitor screen and no longer leak any confidential data.
  • 【2 MOUNTING OPTIONS FOR EASY INSTALLATION】The Peslv 24 inch privacy screen for monitor supply 2 installation options, Various installation options, are Compatible with both 24" computer monitors with raised bezels and full-screen 24" computer monitors without raised bezels, and convenient installation allows you to complete the installation in 9 seconds. NOTE: Monitors without raised bezels are only available with mounting option 2.
  • 【EXCLUSIVE DOUBLE-SIDED TECHNOLOGY】24-inch monitor privacy filter has a double-sided surface technology developed by Peslv. Matte or Glossy. With the matte surface facing outward, you can experience the advanced AG anti-glare technology from Germany while maintaining a 30-degree privacy angle, softening the strong light outdoors, and making the screen content clearly visible. With the glossy side facing outward, you can get a super anti-peeping effect with a privacy angle of 26 degrees.
  • 【PROTECT SCREEN ALSO EYES】Filtering optical materials imported from Japan can reduce 92% of blue light and 98% of UV light, and filter all harmful light emitted from the screen to protect your eyes. The high-transparent and reinforced built-in protective layer not only presents high-definition picture quality but also protects your screen from scratches. Hurry up and place an order, own a privacy screen for a computer monitor 24 inch, and protect your monitor screen and your eyes.

Security and correctness

Blocking CSS can make elements move or disappear, while blocking images can alter intrinsic dimensions and lazy-loading behavior. Scrapers that rely on selectors should wait for the structural element they need, not for visual styling. If a script requires an image response to resolve, failing that request may change application behavior.

Rule maintenance

Keep the block list close to the code that owns browser setup, document why each pattern exists, and test representative URLs after site changes. Prefer narrowly scoped patterns when a broad wildcard could block an API or script accidentally.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a clean screenshot rather than browser-level experimentation, ScreenshotNeo provides a single HTTP request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a screenshot, use the API documented at https://screenshotneo.com/docs/:

Best Value
ZOEGAA [2-Pack Computer Privacy Screen Protector 24 Inch 16:9 Aspect Ratio
  • [How To Determine The Screen Size]: Before Purchasing Our 24 inch privacy screen for monitor, Please Measure The Size Of Your Computer Screen First. Our computer privacy screen 24 inch Is Suitable For Computer Screens With A Width Of 20.92 Inches (53.13 Cm), A Height Of 11.77 Inches (29.89 Cm), And A Diagonal Length Of 24 Inches (60.96 Cm). (It Is Not Recommended To Choose The Size Only Based On The Diagonal Length.) The ZOEGAA 24-Inch 16:9 computer privacy screen Is Compatible With HP, Samsung, Dell, Lenovo, Acer, ASUS, Viewsonic And Other 24-Inch 16:9 Computer Monitors. Welcome To Your Purchase!
  • [Outstanding Privacy Effect]: The Engineer Team Of ZOEGAA Has Collected Suggestions From Over 5,000 Computer Users And Corrected The Anti-Peep Viewing Angle Of The Micro-Blind Optical Technology For 35,462 Times To Ensure That The View Beyond ±30 Degrees Will Be Hidden. People On Your Left And Right Will See A Black Screen.
  • [How To Install]: ZOEGAA 24 inch monitor privacy screen Supports 2 Installation Methods. The First One Is The Insert Type Installation, Which Is removable. The Second One Is The Mounting Adhesive Installation, Which Is Non-Detachable. For Detailed Installation Methods, Please Refer To The Pictures Or Videos In The Listing.
  • [Better Clarity]: ZOEGAA privacy screen 24 inch monitor. It Has Added An AR High-Definition Light-Transmitting Layer, Which Enables The computer monitor privacy screen To Maintain Its Original Clarity While Achieving The Anti-Spy Effect; It Will Not Cause Eye Fatigue Due To The Installation Of The privacy screen for monitor.
  • [Reversible Glossy And Matte Surfaces]: The 24 in privacy screen for monitor Of ZOEGAA Has Two Different Surface Textures - The Glossy Surface Offers Better Anti-Peeping Effect, While The Matte Surface Provides Better Anti-Glare Performance. The Matte Surface Is Suitable For Use In Strong Light Environments. This 24 inch monitor privacy screen Also Has Anti-scratch And Anti-Fingerprint Functions, Ensuring That You Won't Worry About Being Damaged By sharp Objects During Use. It Is Washable And Can Achieve A Brand-New Appearance After Being Washed.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. Every plan includes its features; the Free plan provides 1,000 screenshots per month without a card, and paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to start.

FAQ

Can I block only images from one host?

Yes. Put that host in the URL pattern and combine it with the image suffixes you need, or use Fetch to decide per request. Test overlapping allow and block rules because pattern order matters.

Does blocking CSS stop inline styles?

No. Network blocking affects requests. Inline <style> elements and style attributes are already in the document and require a different page-manipulation approach.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I use Network blocking or Fetch in production?

Use Network blocking for stable, predictable URL lists. Use Fetch when resource type or request-by-request policy matters, and provide a handler for every paused request.

Frequently Asked Questions

Can I block fonts and JavaScript with the same approach?

Yes, if their URLs are predictable you can add matching Network URL patterns. For type-based decisions, extend the Fetch handler with the corresponding resource type, but test carefully because scripts and fonts can be required for page logic.

Will a blocked image still count as a failed page load?

It can change application behavior, but it is not evidence that the browser allowed the image. Inspect request events and the page’s fallback logic to determine what happened.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.