ZenRows automatically blocks certain resource types by default, such as stylesheets and images, to optimize scraping speed and reduce unnecessary data load. We recommend only using this parameter when you need to customize the default blocking behavior or when troubleshooting specific issues.
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:Python
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:Python
Combine with other parameters
Use Block Resources with complementary features for optimal results:Python
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:1
Compare HTML outputs
Compare the HTML obtained with and without resource blocking to identify missing elements.
Python
2
Test individual resource types
Block one resource type at a time to identify the problematic category.
Python
3
Adjust blocking strategy
Remove problematic resource types from your blocking configuration.
Python
Performance vs. content trade-offs
Balance optimization with content completeness:Python
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?
ZenRows automatically blocks stylesheets and images by default to optimize scraping speed and reduce data usage. You can override this behavior by setting
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?
Yes, blocking scripts can prevent dynamic content from loading properly. If you need content that’s loaded via JavaScript, avoid blocking the
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?
Bandwidth savings vary significantly depending on the website’s content and design. Image-heavy sites can significantly reduce data transfer by blocking images and media. Text-focused sites may achieve savings by blocking stylesheets and fonts.
Can I block resources when not using js_render?
Can I block resources when not using js_render?
No, the
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?
Blocking XHR or Fetch requests prevents the page from making AJAX calls, which can result in missing dynamic content. Only block these if you’re certain the content you need is available in the initial HTML without requiring additional API calls.
Does blocking resources affect the JSON Response feature?
Does blocking resources affect the JSON Response feature?
Yes, if you block
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?
No, you must specify exact resource type names from the supported list. You cannot use wildcards or custom patterns. To block multiple types, separate them with commas, such as
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?
Start by blocking only visual resources (
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.