Take a website screenshot without cookie banners, popups or ads
A screenshot without a cookie banner is what every thumbnail, archive and monitoring job wants, and what a headless browser rarely delivers. Consent dialogs, newsletter popups and ad slots cover the content a human would reach in one click. The Screenshot API blocks the third-party noise by default with its built-in adblock and gives you two options for anything the site ships itself.
Cookie banners and ads cover the page you wanted to capture
An automated browser is always a first-time visitor: no stored consent, no dismissed popup, no ad preferences. Every capture gets the full consent wall, and the article, the product or the dashboard you wanted sits dimmed behind it.
The usual fixes are fragile. A fixed delay does not remove anything. A script that hunts for an “Accept” button breaks when the label, the language or the vendor changes. And because ads and consent scripts load late and shift the layout, two captures of the same URL taken an hour apart rarely match.
The adblock parameter, enabled by default, stops third-party requests for advertisements, trackers and cookie consent services at the network level, before the page renders. A banner built into the site’s own code is not a third-party request, so it needs a click on its button or a rule injected with styles. Both are one parameter away.
How to remove cookie consent popups and ads from a screenshot
Work in layers: keep adblock on, click the consent button when the banner is first-party, and hide the wrapper with injected CSS when clicking is unreliable. The page interaction guide walks through each layer with live examples.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { url } = await microlink.screenshot('https://example.com', {
adblock: true
})adblock is true by default, so you can leave it out. Ads, trackers and third-party consent services are blocked before rendering, and the response carries the hosted image URL.
import createClient from 'microlink.io'
const microlink = createClient({
apiKey: process.env.MICROLINK_API_KEY
})
const { url } = await microlink.screenshot('https://example.com', {
click: ['#cookie-accept', '.newsletter-close'],
waitForSelector: 'main'
})Selectors are clicked in array order, so you can close one layer before the next. waitForSelector then holds the capture until the content you care about is visible.
curl 'https://api.microlink.io/?url=https%3A%2F%2Fexample.com&screenshot=true&meta=false&styles=.cookie-banner%2C+.ad-slot+%7B+display%3A+none+%21important+%7D'Injected CSS takes the elements out of the layout without depending on a clickable button. styles accepts inline rules or the absolute URL of a stylesheet.
- adblock Blocks third-party ad, tracker and cookie consent requests. On by default; set it to false to capture the page as a first-time visitor sees it.
- click One CSS selector or an ordered array of selectors to click before the capture.
- styles Inline CSS or an absolute stylesheet URL injected into the page before the capture.
- modules Injects JavaScript as an ES module when a banner needs more than CSS to go away.
Reach for styles before scripts: CSS cannot break the page, and it keeps working when the button label changes. When nothing else is enough, the function parameter gives you full control of the browser page.
Why blocking the request beats hiding the banner
Hiding a popup after it loads is a race. Blocking the request that creates it is faster and repeatable, which is what an ad-free screenshot API needs at volume.
The engine is the open-source Cliqz adblocker running inside the capture browser, so the filtering happens before a single ad or consent script executes.
The same default keeps documents readable in the clean PDF recipe, since adblock applies to every request that renders a page.
When not to: if you need the consent flow itself in the picture, for compliance evidence or a UX review, set adblock to false and capture the page as a first-time visitor sees it.
FAQ
How do I take a screenshot without the cookie banner?
Do I need to enable adblock to get ad-free screenshots?
Which cookie consent popups does the screenshot adblock remove?
How do I hide a banner in a screenshot when its button has no stable selector?
Does blocking ads change the layout of the screenshot?
Solve the next problem with the same API
Screenshot a single element
Screenshots of JavaScript-rendered pages
Screenshots behind a login
Faster, smaller screenshots
Clean PDFs without ads or banners
Clean Markdown, no boilerplate
Ready for clean screenshots?
Ads and consent popups are gone by default, and first-party banners take one option. Start on the free endpoint and capture your first clean page today.