The Block Resources parameter prevents your headless browser from downloading specific types of content that aren’t essential for your scraping task. By blocking unnecessary resources, such as images, stylesheets, fonts, and media files, you can significantly improve scraping efficiency, reduce loading times, optimize performance, and minimize bandwidth usage. When you block resources, ZenRows instructs the browser to ignore requests for the specified content types, allowing pages to load faster and consume less data. This is particularly valuable when scraping content-heavy sites where you only need the text data or specific elements.Documentation Index
Fetch the complete documentation index at: https://docs.zenrows.com/llms.txt
Use this file to discover all available pages before exploring further.
How Block Resources works
Block Resources operates at the network level within the browser, intercepting requests for specified resource types before they’re downloaded. When the browser encounters a request for a blocked resource type, it prevents the download entirely, reducing both loading time and bandwidth consumption. This process affects:- Page loading speed by eliminating unnecessary downloads
- Bandwidth usage by preventing large file transfers
- Memory consumption by reducing the amount of data processed
- Rendering time by focusing only on essential content
- Network request volume by filtering out non-critical resources
Basic usage
Add theblock_resources parameter with comma-separated resource types to your request:
Available resource types
ZenRows supports blocking the following resource types:Content resources
stylesheet- CSS files that define visual styling and layoutimage- All image formats including JPG, PNG, GIF, SVG, and WebPmedia- Audio and video files of all formatsfont- Web fonts including WOFF, WOFF2, TTF, and OTF files
Script and dynamic content
script- JavaScript files and inline scriptsxhr- XMLHttpRequest calls used for AJAX functionalityfetch- Modern Fetch API requests for dynamic content loadingeventsource- Server-sent events for real-time data streamswebsocket- WebSocket connections for bidirectional communication
Application resources
texttrack- Video subtitle and caption filesmanifest- Web app manifests containing application metadataother- Any resource types not specifically categorized above
Special values
none- Disables all resource blocking, allowing everything to load
When to use Block Resources
Block Resources is essential for these scenarios:Performance optimization:
- Large-scale scraping - Reduce bandwidth and processing time across many requests
- Content-heavy sites - Skip images and media when extracting text data
- Slow connections - Minimize data transfer in bandwidth-limited environments
- High-volume operations - Optimize resource usage for continuous scraping tasks
- Cost reduction - Lower bandwidth costs for cloud-based scraping operations
Content-specific extraction:
- Text-only scraping - Extract articles, reviews, or descriptions without visual elements
- Data mining - Focus on structured data while ignoring presentation layers
- API monitoring - Allow dynamic requests while blocking static resources
- Search engine optimization - Analyze content structure without styling interference
- Accessibility testing - Test content availability without visual dependencies
Troubleshooting and debugging:
- JavaScript conflicts - Isolate issues by selectively blocking script types
- Loading problems - Identify problematic resources causing page failures
- Performance analysis - Measure impact of different resource types on loading speed
- Content validation - Verify that essential content doesn’t depend on blocked resources
Disabling resource blocking
To turn off ZenRows’ default resource blocking and allow all content to load:block_resources=none when:
- You need complete visual fidelity
- Debugging layout or styling issues
- Testing how pages appear to real users
- Analyzing complete resource loading patterns
- Ensuring no content dependencies are missed
Best practices
Monitor content integrity
Verify that blocked resources don’t affect essential content:Combine with other parameters
Use Block Resources with complementary features for optimal results:Troubleshooting
Common issues and solutions
| Issue | Cause | Solution |
|---|---|---|
| Missing content | Essential scripts blocked | Remove script from blocked resources |
| Incomplete data | XHR/Fetch requests blocked | Allow xhr and fetch resources |
| Layout issues | CSS dependencies | Remove stylesheet from blocking |
| Slow loading | Too many resources allowed | Add more resource types to blocking |
| JavaScript errors | Font or media dependencies | Test with individual resource types |
Debugging missing content
When content disappears after blocking resources:Compare HTML outputs
Test individual resource types
Performance vs. content trade-offs
Balance optimization with content completeness:Pricing
Theblock_resources parameter doesn’t increase the request cost. You pay the JavaScript Render (5 times the standard price) regardless of the wait value you choose.
Frequently Asked Questions (FAQ)
What resources does ZenRows block by default?
What resources does ZenRows block by default?
block_resources=none to allow all resources, or by specifying custom blocking for specific resource types.Will blocking JavaScript break dynamic content loading?
Will blocking JavaScript break dynamic content loading?
script, xhr, and fetch resource types. Focus on blocking visual resources like image, media, font, and stylesheet instead.How much bandwidth can I save by blocking resources?
How much bandwidth can I save by blocking resources?
Can I block resources when not using js_render?
Can I block resources when not using js_render?
block_resources parameter only works with js_render=true because resource blocking operates within the browser environment during JavaScript rendering. For static HTML requests, resource blocking isn’t applicable.What happens if I block XHR or Fetch requests?
What happens if I block XHR or Fetch requests?
Does blocking resources affect the JSON Response feature?
Does blocking resources affect the JSON Response feature?
xhr or fetch resources, those requests won’t appear in the JSON Response XHR array. However, blocking visual resources, such as images and stylesheets, won’t affect the capture of API calls and can reduce the overall response size.Can I use wildcards or patterns in resource blocking?
Can I use wildcards or patterns in resource blocking?
image,media,font.How do I know which resources are safe to block for my use case?
How do I know which resources are safe to block for my use case?
image,media,font,stylesheet) and test if your target content is still available. If content is missing, remove resource types one by one until you find the minimal blocking configuration that preserves your required data.