Appearance
Cookie Blocking
Block cookie consent banners from appearing in your screenshots.
Plan Requirement
Cookie blocking requires a Starter plan or higher.
Usage
Set blockCookies=true to automatically dismiss cookie consent popups:
bash
curl "https://api.urlpix.com/v1/screenshot?url=https://example.com&blockCookies=true" \
-H "X-API-Key: sk_live_YOUR_KEY" \
-o clean.pngHow It Works
When blockCookies is enabled, the renderer injects CSS and JavaScript to hide and dismiss common cookie consent banners before taking the screenshot. It targets well-known consent frameworks and their selectors.
Targeted Selectors
The following cookie consent frameworks are automatically blocked:
| Framework | Selectors |
|---|---|
| CookieBot | #CybotCookiebotDialog, #CybotCookiebotDialogBodyUnderlay |
| OneTrust | #onetrust-banner-sdk, #onetrust-consent-sdk, .onetrust-pc-dark-filter |
| Cookie Notice | #cookie-notice, .cookie-notice-container |
| GDPR Cookie | #gdpr-cookie-notice, .gdpr-cookie-notice |
| Cookie Law | .cookie-law-info-bar, #cookie-law-info-bar |
| Quantcast | .qc-cmp-showing, #qcCmpUi |
| Generic | [class*="cookie-banner"], [class*="cookie-consent"], [id*="cookie-popup"] |
JavaScript Example
javascript
const params = new URLSearchParams({
url: 'https://example.com',
blockCookies: 'true',
format: 'webp',
})
const response = await fetch(
`https://api.urlpix.com/v1/screenshot?${params}`,
{ headers: { 'X-API-Key': 'sk_live_YOUR_KEY' } }
)Tips
- Combine with
delayif the consent banner loads after the initial page render - Some sites use custom cookie implementations that may not be caught by the default selectors
- Use
customCSS(Pro+) to target site-specific cookie banners not covered by the defaults