Recommended Free Tools
Use the method that matches your control of the page. If you own the banner markup, add data-html2canvas-ignore to its outer element. If you cannot edit the markup, pass an ignoreElements predicate that identifies the banner. If you want the live page untouched, remove or adjust the banner in html2canvas’s cloned document with onclone. These options exclude elements from html2canvas’s DOM reconstruction; they do not create a native browser screenshot or bypass cross-origin iframe security.
Choose the right removal method
html2canvas walks the readable DOM and builds a canvas representation. It does not copy the browser’s final pixels. That distinction matters: a banner that is accessible in the page DOM can be excluded, while a banner inside an inaccessible, cross-origin iframe cannot be selected by the parent page.
| Method | Use it when | What changes | Main consideration |
|---|---|---|---|
data-html2canvas-ignore |
You control the banner template | A marked element and its subtree are skipped | Put the attribute on the banner wrapper |
ignoreElements |
You cannot change the source markup | A predicate filters matching elements | Use a specific, verified selector |
onclone |
You need capture-only DOM edits | The cloned document is changed before rendering | The live page remains unchanged |
All three options are documented by the html2canvas project: see the examples, configuration options, and the clone-callback documentation.
1. Add data-html2canvas-ignore when you own the banner
The declarative approach is usually the easiest to audit. Add the documented attribute to the outermost consent element, not merely to a close button or one paragraph. html2canvas then skips that element and all of its descendants.
<div class="cookie-banner" data-html2canvas-ignore>
<p>We use cookies to improve the site.</p>
<button type="button" id="accept-cookies">Accept</button>
</div>
Capture after the banner has been inserted into the document:
import html2canvas from 'html2canvas';
const target = document.querySelector('#page');
const canvas = await html2canvas(target);
document.querySelector('#output').src = canvas.toDataURL('image/png');
If your application renders the banner asynchronously, wait for the banner component (or for the page’s ready state) before calling html2canvas. The attribute is only useful when it is present in the DOM that html2canvas receives.
2. Use ignoreElements when the markup cannot be changed
ignoreElements is a function. Return true for the banner element you want excluded and false for everything else. Match a stable class, ID, data attribute, or another identifier belonging specifically to your consent component.
import html2canvas from 'html2canvas';
const bannerSelector = '[data-consent-banner], .cookie-banner';
const target = document.querySelector('#page');
const canvas = await html2canvas(target, {
ignoreElements: (element) => element.matches(bannerSelector),
});
The selector above is illustrative. Cookie-management vendors and site themes use different markup, so inspect the page and replace it with the selector that actually identifies your wrapper. Avoid broad rules such as element.tagName === 'DIV' or “ignore every button”; those can remove legitimate content from the capture.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallIf the banner wrapper itself does not match because a framework inserts an extra container, inspect the rendered DOM and test the predicate in DevTools:
document.querySelectorAll('[data-consent-banner], .cookie-banner').length
A result of zero means the selector is wrong, the banner has not rendered yet, or the banner is not in this document.
3. Edit only the cloned document with onclone
Use onclone when the source page should remain exactly as the visitor sees it, but the render copy needs a removal or another capture-specific adjustment. html2canvas calls the callback with the cloned document used for rendering.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import html2canvas from 'html2canvas';
const target = document.querySelector('#page');
const canvas = await html2canvas(target, {
onclone: (clonedDocument) => {
clonedDocument.querySelector('.cookie-banner')?.remove();
},
});
Removing the node in the clone does not dismiss consent, change cookies, or alter the live page. If you need to preserve layout while hiding the banner, change its cloned styles instead:
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsonclone: (clonedDocument) => {
const banner = clonedDocument.querySelector('.cookie-banner');
if (banner) {
banner.style.display = 'none';
}
}
Removing versus hiding can produce different layout results. Removing a normal-flow banner lets content move upward; setting display: none does the same. If the banner is fixed or absolutely positioned, either operation generally leaves the underlying layout unchanged. Verify the result for your component.
A complete browser example
This example waits for a target element, excludes a banner in the cloned document, and downloads a PNG. It assumes html2canvas is installed with a package manager or loaded from a CDN as described in the project’s Getting Started guide.
import html2canvas from 'html2canvas';
async function captureWithoutConsent() {
const target = document.querySelector('#page');
if (!target) throw new Error('Capture target #page was not found');
const canvas = await html2canvas(target, {
onclone: (clonedDocument) => {
const banner = clonedDocument.querySelector(
'[data-consent-banner], .cookie-banner'
);
banner?.remove();
},
backgroundColor: '#ffffff',
useCORS: true,
});
const link = document.createElement('a');
link.download = 'page-without-cookie-banner.png';
link.href = canvas.toDataURL('image/png');
link.click();
}
captureWithoutConsent().catch(console.error);
useCORS can help with images that explicitly permit cross-origin loading, but it does not grant access to arbitrary cross-origin documents or frames. It is unrelated to banner filtering.
Cross-origin iframe limits
If the consent UI is inside an iframe from another origin, the parent page cannot read that frame’s contentDocument because of browser same-origin protections. Consequently, a parent-page attribute, ignoreElements predicate, or onclone callback cannot select the iframe’s internal banner.
- If the iframe is same-origin, inspect its document and apply the relevant method inside that document.
- If it is cross-origin, capture content outside the frame or use a consent/capture configuration provided by the iframe owner.
- Do not assume that visually covering an iframe with another element removes its pixels from html2canvas; the iframe remains an inaccessible rendering boundary.
These restrictions are part of html2canvas’s documented model, not a missing selector trick. Read the project’s About documentation for the library’s rendering and security limitations.
Timing, selectors and layout checks
Wait for the banner state you intend to capture
Single-page applications can insert a consent component after your capture call. Wait for a known page condition, a framework render promise, or a short polling loop that confirms the selector exists. A fixed delay is less reliable than observing a real state transition.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Target the wrapper, not a child
Marking or removing only the text node, close button, or backdrop can leave the banner’s background, padding, or shadow. Select the outer wrapper that owns the entire consent subtree.
Check fixed overlays and stacking
A fixed banner may overlap the target even when its selector is correct if another copy is inserted later. In the clone callback, count matches and remove every intended instance:
Free tools Windows power users keep installed
One-click scans. No signup required.
onclone: (clonedDocument) => {
clonedDocument
.querySelectorAll('[data-consent-banner], .cookie-banner')
.forEach((node) => node.remove());
}
Confirm the output rather than the live page
Open the generated image and check the bottom edge, sticky headers, and any backdrop. The browser page can look correct while the reconstructed canvas differs because html2canvas supports only the styles and content it can read.
Troubleshooting common failures
| Symptom | Likely cause | Fix |
|---|---|---|
| The banner still appears | The selector does not match, the callback ran before insertion, or another banner instance exists | Inspect the rendered DOM, test querySelectorAll, wait for insertion, and use querySelectorAll in onclone when necessary |
| Other content disappears | The predicate is too broad | Replace tag-wide or button-wide matching with a banner-specific class, ID, or data attribute |
| The live page changes | Removal was performed on the source document rather than the clone | Move the edit into onclone, or use data-html2canvas-ignore without mutating the DOM |
| Only part of the banner is gone | The attribute or selector was applied to a child | Target the outer banner container and its subtree |
| An iframe banner cannot be selected | The frame is cross-origin | Use an owner-provided configuration, capture outside the frame, or handle a same-origin frame from its own document |
| The canvas differs from visible pixels | html2canvas reconstructs from DOM information and may not support every style or resource | Check the supported content, simplify capture-only styles, and treat the output as a DOM render rather than a native screenshot |
| Images are blank or taint the canvas | Image origin or server headers prevent readable loading | Serve images with suitable CORS headers, use same-origin assets, or omit inaccessible resources; useCORS cannot bypass server policy |
Performance and reliability considerations
- Capture the smallest element that contains the required content instead of
document.bodywhen possible. - Use one filtering strategy consistently; a narrow selector is cheaper to reason about and less likely to remove content.
- Wait for fonts, images, and asynchronous components before capturing if visual completeness matters.
- For long pages, expect more DOM traversal and memory use. A full-page canvas can be expensive; split captures when your application permits it.
- Do not treat html2canvas as a security boundary. It cannot read content the browser’s same-origin policy hides.
Or skip the browser setup
If you need a server-side screenshot rather than a DOM reconstruction, ScreenshotNeo accepts one GET request and returns PNG, JPEG, WebP, or PDF. Before capture it accepts the cookie/consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
Use the API documentation at screenshotneo.com/docs/ for all options. A minimal cURL request is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The equivalent Python request:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
And Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo includes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, pre-capture clicks, hide selectors, waits, request/resource blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, and an OpenAPI specification. Common screenshot-API parameter names also work when switching.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
| Plan | Included shots | Price |
|---|---|---|
| Free | 1,000 per month | $0, no card |
| Starter | 3,000 | $5 |
| Growth | 15,000 | $15 |
| Pro | 60,000 | $39 |
| Scale | 250,000 | $99 |
| Business | 1,000,000 | $249 |
Every feature is available on every plan, and yearly billing provides two months free. Start with 1,000 free screenshots a month with no card; paid plans start at $5 for 3,000.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.FAQ
Does data-html2canvas-ignore hide the banner for visitors?
No. It tells html2canvas to skip the element during rendering; it does not alter what visitors see.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Can I remove a banner after accepting cookies?
Yes, if your consent code removes or hides it before capture. The html2canvas methods described here are capture controls, not a replacement for consent management.
Which method is safest for an uneditable third-party component?
Use ignoreElements with a selector that uniquely identifies the component, or onclone if you need capture-only changes. Neither can inspect a cross-origin iframe.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Frequently Asked Questions
Can I use a CSS selector with data-html2canvas-ignore?
No. The attribute is placed directly on the element. For selector-based matching, use the ignoreElements predicate or remove the node in onclone.
Will removing the banner improve cookie compliance?
No. These techniques affect the screenshot render only. Keep your site’s consent logic and disclosure behavior unchanged.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

