---
title: "Resource Blocking & Request Control | ScreenshotAPI Docs"
slug: "/docs/renderScreenshot/block-resources"
description: "Control webpage behavior by blocking ads, trackers, chat widgets, cookie banners. Disable JavaScript, CSS, or requests to optimize rendering."
---

# Resource Blocking & Request Control

One of the handy things about ScreenshotAPI is that you can actually control what loads on a page before the screenshot is taken. So if a site has annoying ads, cookie popups, chat bubbles, or tracking scripts cluttering the view, you can block all of that and get a much cleaner result.

You can also go deeper and block specific resource types like JavaScript, CSS, or particular network requests. This is really useful when you want to test how a page looks without certain elements, speed up the capture process, or just grab a simplified version of a page for analysis or automation. It gives you a lot of flexibility depending on what you're actually trying to do.

```js

const axios = require("axios");

let config = {
	method: "get",
	maxBodyLength: Infinity,
	url: "https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&block_ads=true&no_cookie_banners=true&block_chat_widgets=true&block_js=true&block_specific_requests=https://example.js&[OPTIONS]",
	headers: { }
};

axios.request(config).then((response) => {
	console.log(JSON.stringify(response.data));
}.catch((error) => {
	console.log(error);
});
```

```php

<?php
	$client = new http.Client;
	$request = new http.Client.Request;
	$request->setRequestUrl("https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&block_ads=true&no_cookie_banners=true&block_chat_widgets=true&block_js=true&block_specific_requests=https://example.js&[OPTIONS]");
	$request->setRequestMethod("GET");
	$request->setOptions(array());

	$client->enqueue($request)->send();
	$response = $client->getResponse();
	echo $response->getBody();
?>
```

```go

package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {
	url := "https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&block_ads=true&no_cookie_banners=true&block_chat_widgets=true&block_js=true&block_specific_requests=https://example.js&[OPTIONS]"
	method := "GET"

	client := &http.Client { }
	req, err := http.NewRequest(method, url, nil)

	if err != nil {
		fmt.Println(err)
		return
	}

	res, err := client.Do(req)
	if err != nil {
		fmt.Println(err)
		return
	}

	defer res.Body.Close()
	body, err := io.ReadAll(res.Body)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}
```

```java

OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder().url("https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&block_ads=true&no_cookie_banners=true&block_chat_widgets=true&block_js=true&block_specific_requests=https://example.js&[OPTIONS]"
	.method("GET", body)
	.build();
Response response = client.newCall(request)
	.execute();
```

```py

import requests

url = "https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&block_ads=true&no_cookie_banners=true&block_chat_widgets=true&block_js=true&block_specific_requests=https://example.js&[OPTIONS]"
payload = {}
headers = {}

response = requests.request("GET", url, headers, data=payload)
print(response.text)
```

```ruby

require "uri"
require "net/http"

url = URI("https://shot.screenshotapi.net/v3/screenshot?token=TOKEN&url=https%3A%2F%2Fwww.apple.com%2F&block_ads=true&no_cookie_banners=true&block_chat_widgets=true&block_js=true&block_specific_requests=https://example.js&[OPTIONS]")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Get.new(url)

response = https.request(request)
puts response.read_body
```

## Block Ads

**Parameter Name :** `block_ads`

It allows you to prevent advertisements from being loaded and displayed during the rendering process. When enabled, the system blocks requests to known ad networks before the page is rendered, resulting in a cleaner and distraction-free output.

This helps improve visual clarity, reduce unwanted elements in screenshots, and can also enhance performance by eliminating unnecessary network requests.

**Options**

*   **true:** Blocks ads from loading by filtering requests to common ad networks before rendering.
    
*   **false:** Allows all ads to load normally as part of the webpage.
    

**When to use**

*   Use `true` when you need clean screenshots for presentations, reports, or documentation without ad clutter. It is also useful for consistent visual comparisons and UI analysis.
    
*   Use `false` when you need to capture the page exactly as users see it, including advertisements.
    

**Default value:**`false`.

## Block Tracking

**Parameter Name :** `block_tracking`

The use of this variable ensures that no tracking scripts or services load during the process of rendering. If enabled, this means that any requests to known tracking domains are prevented from loading until after the web page has been rendered.

This ensures that the web page renders more cleanly, without the inclusion of any tracking scripts that could impact performance or manipulate the page's content.

**Options**

*   **true:** Blocks tracking scripts and analytics services from loading during rendering.
    
*   **false:** Allows all tracking and analytics scripts to load normally.
    

**When to use**

*   Use `true` when you require a privacy-oriented rendering, minimize network requests, or ensure consistency without any tracking-induced variability.
    
*   Use `false` when you need to capture the page exactly as it behaves in a real user environment, including analytics and tracking behavior.
    

**Default value:**`false`.

## No Cookie Banners

**Parameter Name :** `no_cookie_banners`

No cookie consent banners or popups will be displayed during the rendering process if no_cookie_banners is used. Once set to true, the system will block or hide these pop-ups prior to taking a screenshot.

This ensures a cleaner output by eliminating overlays that could distract viewers and block essential parts of the page, especially those that comply with GDPR laws.

**Options**

*   **true:** Hides or blocks cookie banners before rendering, ensuring a clean view of the page.
    
*   **false:** Allows cookie banners to appear as they normally would on the website.
    

**Default value:**`false`.

## Block Chat Widgets

**Parameter Name :** `block_chat_widgets`

It allows you to disable chat widgets during the rendering process by blocking all related scripts and network requests. When enabled, it prevents live chat popups, support bubbles, and messaging interfaces from loading on the page.

This ensures that the final website screenshot remains clean and free from overlay elements that can obstruct important content or affect layout consistency.

**Options**

*   **true:** Blocks all chat widget resources and prevents chat interfaces from appearing.
    
*   **false:** Allows chat widgets to load and function normally.
    

**Default value:**`false`.

## Block JS

**Parameter Name :** `block_js`

This parameter allows you to disable all JavaScript execution during the rendering process by blocking requests for JavaScript resources. When enabled, the page is rendered without running any scripts, resulting in a static version of the website.

This can significantly improve performance and reduce rendering time, but it may also prevent dynamic content, interactive elements, and client-side functionality from loading.

**Options**

*   **true:** Blocks all JavaScript files and prevents script execution during rendering.
    
*   **false:** Allows JavaScript to load and execute normally.
    

**When to use**

*   Use `true` when you need a fast, static snapshot of a page, or when debugging layout and structure without JavaScript interference. It is also useful for reducing resource usage in certain automation workflows.
    
*   Use `false` when full page functionality is required, especially for modern websites that rely heavily on JavaScript for rendering content.
    

**Default value:**`false`.

_`Note:` Enable this option only when necessary, as blocking JavaScript may break page functionality, hide content, or result in incomplete renders._

## Block Stylesheets

**Parameter Name :** `block_stylesheets`

It disables loading of all CSS files during the rendering process. When enabled, the page is rendered without any styles, showing only the raw HTML structure without visual formatting.

This can improve performance by reducing resource loading, but it will remove all layout, design, and styling from the final output.

**Options**

*   **true:** Blocks all CSS files, rendering the page without styles.
    
*   **false:** Loads and applies all stylesheets normally.
    

**When to use**

*   Use `true` when you want to analyze the raw structure of a webpage, debug layout issues, or reduce resource usage for faster processing.
    
*   Use `false` when you need a fully styled and visually accurate screenshot.
    

**Default value:**`false`.

## Block Images

**Parameter Name :** `block_images`

It prevents all image resources from being loaded during web screenshot. When enabled, the browser skips requests for image files, resulting in a faster and lighter render without visual media.

This can significantly reduce bandwidth usage and improve performance, especially for image-heavy pages, but it will remove all visual content from the final output.

**Options**

*   **true:** Blocks all image resources, preventing them from loading or appearing in the render.
    
*   **false:** Allows all images to load and display normally.
    

**Supported Image Types**

Includes common formats such as:

*   .jpg
*   .jpeg
*   .png
*   .gif
*   .bmp
*   .tiff
*   .tif
*   .webp
*   .svg
*   .heif
*   .heic
*   .ico
*   .raw

**When to use**

*   Use `true` when you want faster rendering, reduced data usage, or need to focus only on text and layout structure without visual distractions.
    
    **Example:** Running large-scale SEO audits where you only need page content and structure, not images.
    
*   Use `false` when full visual accuracy is required, including all images and media content.
    
    **Example:** Creating client-ready screenshots, marketing reports, or UI previews where visuals and images matter.
    

**Default value:**`false`.

## Block Media

**Parameter Name :** `block_media`

It prevents audio and video resources from being loaded during the website capture. When enabled, the system blocks all requests related to media files, ensuring that no audio or video content is played or displayed in the final output.

This helps reduce bandwidth usage and speeds up rendering, especially on pages that contain embedded videos, background media, or autoplay content.

**Options**

*   **true:** Blocks all media files (audio and video) from loading during rendering.
    
*   **false:** Allows all media content to load and play normally.
    

**Supported Media Types**

Includes common formats such as:

*   .mp3
*   .wav
*   .ogg
*   .mp4
*   .webm
*   .avi
*   .mov
*   .flv
*   .mkv
*   .wmv

**When to use**

*   Use `true` when you want faster rendering or need to avoid unnecessary media playback.
    
    **Example:** Capturing documentation pages or blog articles where embedded videos are not required and only text/layout matters.
    
*   Use `false` when full fidelity is required, including all audio and video elements.
    
    **Example:** Testing media-heavy landing pages or marketing pages where video playback is part of the user experience.
    

**Default value:**`false`.

## Block Fonts

**Parameter Name :** `block_fonts`

This parameter prevents font files from being loaded during the rendering process. When enabled, all requests for external font resources are blocked, and the page falls back to system default fonts instead of custom web fonts. This can slightly improve rendering performance and reduce network requests, but it may change the visual appearance of the page since typography will no longer match the original design.

**Options**

*   **true:** Blocks all font files and forces the browser to use system default fonts.
    
*   **false:** Allows all custom web fonts to load and display normally.
    

**Supported Font Types**

Includes common formats such as:

*   .woff
*   .woff2
*   .ttf
*   .otf
*   .eot

**When to use**

*   Use `true` for performance optimization in bulk processing.
    
    **Example:** Generating thousands of screenshots where custom fonts are not required and system fonts are sufficient for consistency.
    

**Default value:**`false`.

## Block Text Tracks

**Parameter Name :** `block_text_track`

It prevents text track resources such as subtitles, captions, and other timed text files from being loaded during the rendering process. When enabled, the system blocks these resources before the page is rendered, ensuring that no subtitles or caption overlays appear in media players. This helps produce cleaner renders by removing additional text-based media layers that may interfere with screenshots or visual output.

**Options**

*   **true:** Blocks all text track files such as subtitles and captions from loading during rendering.
    
*   **false:** Allows text tracks (subtitles/captions) to load and display normally.
    

**When to use**

*   Use `true` when you need clean screenshots of video players or media pages without subtitle overlays.
    
    **Example:** Capturing product demo pages or embedded videos where captions would clutter the visual output.
    

**Default value:**`false`.

## Block XHR Requests

**Parameter Name :** `block_xhr`

This parameter prevents XMLHttpRequest (XHR) calls from being executed during the rendering process. XHR requests are commonly used by modern websites to fetch data asynchronously from APIs without reloading the page. When this option is enabled, all such asynchronous data requests are blocked before rendering, which means dynamically loaded content may not appear in the final screenshot.

**Options**

*   **true:** Blocks all XHR (AJAX) requests and prevents asynchronous data fetching during page capture.
    
*   **false:** Allows XHR requests to execute normally, enabling dynamic content to load.
    

**When to use**

*   Use `true` when you want a static version of a webpage without API-driven updates.
    
    **Example:** Capturing base layout structure of a dashboard without live data changing the UI.
    
*   Use `false` when full dynamic content is needed.
    
    **Example:** Capturing real-time dashboards, analytics panels, or stock market pages where XHR data is essential for accurate representation.
    

**Default value:**`false`.

## Block Fetch Requests

**Parameter Name :** `block_fetch`

This parameter blocks all network requests made using the Fetch API during the rendering process. The Fetch API is widely used in modern web applications to retrieve data asynchronously from servers without reloading the page. When this option is enabled, these requests are blocked before execution, meaning dynamically loaded content that depends on Fetch calls may not appear in the final render.

**Options**

*   **true:** Blocks all Fetch API requests and prevents asynchronous data loading during rendering.
    
*   **false:** Allows Fetch API requests to execute normally, enabling dynamic content to load.
    

**When to use**

*   Capturing the base layout of a SaaS dashboard where live data updates are not required.
    
*   Running bulk screenshot jobs where blocking API calls improves speed and avoids inconsistent dynamic data.
    

**Default value:**`false`.

## Block Event Source

**Parameter Name :** `block_event_source`

It prevents EventSource connections (Server-Sent Events) from being established during the rendering process. EventSource is commonly used for real-time updates, such as live notifications, streaming data, or continuously updating dashboards.

When this option is enabled, all EventSource connections are blocked before rendering, which stops real-time data streams from updating the page content.

**Options**

*   **true:** Blocks all EventSource (SSE) connections and prevents real-time updates during rendering.
    
*   **false:** Allows EventSource connections to function normally, enabling live updates.
    

**When to use**

*   Use `true` when you want a stable snapshot of a page without live updates changing the content.
    
    **Example:** Taking periodic screenshots of a live feed where real-time updates could cause inconsistencies between captures.
    
*   Use `false` when real-time data is essential.
    
    **Example:** Monitoring live notification systems or real-time tracking dashboards where continuous updates must be visible.
    

**Default value:**`false`.

## Block WebSockets

**Parameter Name :** `block_web_socket`

It prevents WebSocket connections from being established during the rendering process. WebSockets are commonly used for real-time, bidirectional communication between the client and server, enabling features like live chats, trading dashboards, multiplayer apps, and instant updates.

**Options**

*   **true:** Blocks all WebSocket connections and prevents real-time communication during rendering.
    
*   **false:** Allows WebSocket connections to function normally, enabling live updates and interactions.
    

**Default value:**`false`.

## Block Manifest

**Parameter Name :** `block_manifest`

It prevents manifest files from being loaded during the rendering process. Manifest files (such as web app manifests or service worker manifests) are used to define how a website behaves as a Progressive Web App (PWA), including installation settings, icons, and offline capabilities. When this option is enabled, all requests for manifest resources are blocked before rendering, which can disable PWA-related features and prevent service worker behavior from affecting the page.

**Options**

*   **true:** Blocks all manifest files and disables PWA-related functionality during rendering.
    
*   **false:** Allows manifest files to load and function normally.
    

**Supported Manifest Types**

Includes:

*   .json
*   .webmanifest

**Default value:**`false`.

## Block Specific Requests

**Parameter Name :** `block_specific_requests`

It allows you to block targeted network requests during the rendering process. Instead of disabling entire resource categories, this option gives you fine-grained control by letting you specify exact URLs, file paths, or patterns that should be prevented from loading.

All matching requests are intercepted and blocked before rendering, helping you remove unwanted dependencies, reduce load time, or control how a page behaves.

**Options**

Provide one or more request patterns separated by commas, spaces, or newlines. Each entry is treated as an individual rule.

*   https://example.com/api/data
    
*   https://example.com/script.js
    
*   https://ads-domain.com
    

**When to use**

*   Blocking a specific analytics API endpoint that slows down rendering but is not required for screenshots.
    
*   Preventing a heavy third-party script (like a chat SDK or tracking library) from loading while keeping the rest of the page intact.
    

**Default value:**`' '` (empty string).
