Link Search Menu Expand Document

Blocking cookie banners

Learn how to block cookie banners with taking screenshots


How it works

The easiest way to hide cookie banners in your screenshots is by using the block_consent_banners parameter.

When set to true, the API will automatically detect and block common cookie consent banners and popups on websites. This is the recommended approach for most use cases.

Simply add block_consent_banners: true to your API request:

{
  "url": "https://example.com",
  "block_consent_banners": true
}

This automatically handles the most common cookie consent frameworks including:

  • OneTrust
  • Cookiebot
  • Quantcast Choice
  • TrustArc
  • Osano
  • And many others

Recommended Method

Using block_consent_banners is the easiest and most reliable way to hide cookie popups. It’s maintained and updated regularly to handle new consent frameworks.

Manual CSS Injection (Advanced)

For custom cookie banners not covered by the automatic blocking, you can still use CSS injection.

Any CSS passed via the css param when generating a URL image will get injected into the page.

The hard part can be figuring out what CSS to use to block the cookie banner. To do this, we recommend visiting the site in Chrome. Use the developer tools inspector to find the ID or CSS class of the cookie banner (the css selector).

Then use this information to override the visibility of the cookie banner.

Here is an example that hides some common cookie banner.s

#onetrust-consent-sdk {
 display: none !important;
}

.qc-cmp2-container {
   display: none !important;
}

To learn about CSS Selectors, we recommend this article.


Need help?

Talk to a human. Please email us support@htmlcsstoimage.com with any questions and we’ll gladly help you get started.


Back to top

Built with extensive integration tests and serious care for developer happiness.
© 2018-2025 Code Happy, LLC.

Page last modified: Jun 21 2025 at 05:45 PM.

Edit this page on GitHub.