You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 41dfc80
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: src/content/docs/parameters/request_overrides.mdx
+20-16Lines changed: 20 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,17 +10,7 @@ import Help from '../../../components/Help.astro';
10
10
11
11
Use `request_overrides` to stop selected network requests while Chrome renders an image. For example, you can prevent a third-party script or image from loading in a screenshot.
12
12
13
-
## When it's useful
14
-
15
-
A page can make requests that add nothing to the image you want to capture. Blocking those requests can help you:
16
-
17
-
-**Spend less time and bandwidth loading assets you won't show.** If a screenshot doesn't need a video or a set of decorative images from your CDN, Chrome doesn't need to download them for that render.
18
-
-**Avoid sending screenshot visits to analytics services.** Block tracking beacons or scripts when you don't want automated renders counted alongside real visitors.
19
-
-**Keep screenshots more consistent.** Third-party chat widgets, ads, and other extras can change or fail independently of your page. Block them when they aren't part of the image.
20
-
21
-
Only block resources your screenshot can do without. Blocking a font, stylesheet, script, or visible image may change the result.
22
-
23
-
## Block rules
13
+
## How it works
24
14
25
15
Pass an array of rules. Each rule currently supports the `block` action and must have a `url` pattern, a `resource_types` array, or both:
26
16
@@ -43,7 +33,23 @@ Pass an array of rules. Each rule currently supports the `block` action and must
43
33
44
34
When a rule has both `url` and `resource_types`, **both must match**. A request is blocked when **any** rule matches. A rule with only `resource_types` applies to matching requests from any URL. Blocking a `document` request can prevent the target page or an embedded frame from loading.
45
35
46
-
## More examples
36
+
<Asidetitle="Availability">
37
+
Request overrides require a paid plan. They work with URL screenshots, HTML/CSS images, and templates. An omitted value, `null`, or an empty array adds no overrides.
38
+
</Aside>
39
+
40
+
## When to use it
41
+
42
+
A page can make requests that add nothing to the image you want to capture. Blocking those requests can help you:
43
+
44
+
-**Spend less time and bandwidth loading assets you won't show.** If a screenshot doesn't need a video or a set of decorative images from your CDN, Chrome doesn't need to download them for that render.
45
+
-**Avoid sending screenshot visits to analytics services.** Block tracking beacons or scripts when you don't want automated renders counted alongside real visitors.
46
+
-**Keep screenshots more consistent.** Third-party chat widgets, ads, and other extras can change or fail independently of your page. Block them when they aren't part of the image.
47
+
48
+
Only block resources your screenshot can do without. Blocking a font, stylesheet, script, or visible image may change the result.
49
+
50
+
## Example usage
51
+
52
+
### Block tracking and chat widgets
47
53
48
54
To leave tracking beacons and a third-party chat widget out of a screenshot, use two rules. The first matches `beacon` requests from any URL; the second matches every request to the widget host:
49
55
@@ -56,6 +62,8 @@ To leave tracking beacons and a third-party chat widget out of a screenshot, use
56
62
}
57
63
```
58
64
65
+
### Skip unused CDN images
66
+
59
67
If your page references CDN images that aren't needed in the finished screenshot, block only that asset path. Other images on the page can still load:
60
68
61
69
```json
@@ -70,10 +78,6 @@ If your page references CDN images that aren't needed in the finished screenshot
70
78
}
71
79
```
72
80
73
-
<Asidetitle="Availability">
74
-
Request overrides require a paid plan. They work with URL screenshots, HTML/CSS images, and templates. An omitted value, `null`, or an empty array adds no overrides.
75
-
</Aside>
76
-
77
81
## Request formats
78
82
79
83
In a JSON image request, pass `request_overrides` as an array, as shown above. In an `application/x-www-form-urlencoded` request, send the entire array as one JSON-encoded field:
0 commit comments