html2canvas has no documented setting for an arbitrary image-rendering order or image queue. To control what appears in front, set the intended DOM structure and CSS layout; to give images time to load, wait for your application’s image readiness before capture and configure imageTimeout deliberately. Those are separate problems: a longer timeout will not fix a blocked cross-origin image.
What “rendering order” means in html2canvas
html2canvas does not take a native screenshot of the browser’s already-composited pixels. It traverses the DOM and uses information about elements and styles to build a representation of the page. The project notes that it supports CSS properties by implementing them, so output is not guaranteed to be pixel-identical to the browser’s display. See the html2canvas About documentation.
That distinction matters because “order” can mean either which content is visually on top, or which image request starts or finishes first. The documented options do not provide an independent image queue or priority control. For visual stacking, express the intended layout in the DOM and CSS that html2canvas reads. For readiness, wait for your application’s content and configure the image timeout. For remote-image access, use CORS or a proxy. These controls address different causes.
Set the intended visual order in DOM and CSS
Arrange overlapping elements with the same layout rules that make the page look right in the browser: DOM structure, positioning, and stacking styles such as z-index where appropriate. html2canvas reconstructs a rendering from page information, so treat the DOM and CSS as its input rather than expecting a separate capture-order option.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →#1 Best Overall
- USB-C 2-in-1 storage OTG: The Lexar JumpDrive Dual Drive D40E features USB Type-A and Type-C connectors in a slim, portable form factor for easy device compatibility
- Transfer speeds up to 100MB/s: Based on internal testing, performance may vary depending upon the host device, interface, and usage conditions. 1MB=1,000,000 bytes
- Plug and Play: Widely compatible with USB Type-C smartphones, tablets, laptops, Macs, and traditional Type-A devices, no software installation required. The 360° swivel design allows for easy switching between connectors without the hassle of losing a cap
- Durable & Compact: The Lexar D40E USB memory stick features a metal enclosure, withstands temperatures from 0° to 50° C (32°F to 122°F), and is lightweight at 26g with dimensions of 70.4 x 16.9 x 11.7mm
- Security & Warranty: Securely protects files using an advanced security software solution with 256-bit AES encryption. Backed by a Lexar 3-year limited warranty
For example, if a foreground image should cover a background image, ensure both are in the intended layout and stacking context before capture:
<div class="artwork">
<img class="background" src="/background.jpg" alt="">
<img class="foreground" src="/foreground.png" alt="">
</div>
<style>
.artwork { position: relative; }
.background { display: block; width: 100%; }
.foreground {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: contain;
}
</style>
This is a layout example, not a promise that every CSS effect or browser rendering detail is reproduced identically. If a particular style is essential, capture a small test case using the same structure and configuration as your production page.
Prepare a capture-only version with onclone
The onclone callback receives the cloned document used for capture. It is useful when the capture needs a different state—for example, revealing a capture-only image, removing a transient element, or adjusting a class—without changing the original page. The callback is documented in the html2canvas configuration reference.
Rank #2
- High-speed USB 3.0 performance of up to 150MB/s(1) [(1) Write to drive up to 15x faster than standard USB 2.0 drives (4MB/s); varies by drive capacity. Up to 150MB/s read speed. USB 3.0 port required. Based on internal testing; performance may be lower depending on host device, usage conditions, and other factors; 1MB=1,000,000 bytes]
- Transfer a full-length movie in less than 30 seconds(2) [(2) Based on 1.2GB MPEG-4 video transfer with USB 3.0 host device. Results may vary based on host device, file attributes and other factors]
- Transfer to drive up to 15 times faster than standard USB 2.0 drives(1)
- Sleek, durable metal casing
- Easy-to-use password protection for your private files(3) [(3)Password protection uses 128-bit AES encryption and is supported by Windows 7, Windows 8, Windows 10, and Mac OS X v10.9 plus; Software download required for Mac, visit the SanDisk SecureAccess support page]
html2canvas(document.querySelector("#capture"), {
onclone: (clonedDocument) => {
const target = clonedDocument.querySelector("#capture");
if (target) {
target.classList.add("for-capture");
}
}
}).then((canvas) => {
document.body.appendChild(canvas);
});
Define any .for-capture styles in your page stylesheet so they can apply to the clone. Make clone-only adjustments in this callback rather than mutating the live source document immediately before capture. onclone can prepare the cloned DOM and styles; it is not a documented mechanism for setting a custom image-fetch sequence.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Wait for application-owned images before calling html2canvas
If your application controls when image sources are assigned or when a gallery, chart, or component becomes ready, wait for that readiness state before starting capture. The html2canvas documentation describes its timeout and clone callback, but does not prescribe one universal application-level wait function. The following helper waits for images already present in a selected element to either load or fail; call it after your app has populated the element.
function waitForImages(root) {
const images = Array.from(root.querySelectorAll("img"));
return Promise.all(images.map((img) => {
if (img.complete) return Promise.resolve();
return new Promise((resolve) => {
img.addEventListener("load", resolve, { once: true });
img.addEventListener("error", resolve, { once: true });
});
}));
}
async function capture() {
const target = document.querySelector("#capture");
await waitForImages(target);
const canvas = await html2canvas(target, {
imageTimeout: 15000
});
document.body.appendChild(canvas);
}
This waits for each current <img> element to reach a load or error event; it does not make a failed image succeed. It also does not wait for CSS background images, images your application adds later, or an application-specific animation or layout operation. For those, wait on the component or state your own code controls, then run the capture. Avoid waiting on an event that can never occur, such as a loading flag that is not cleared on error.
Rank #3
- What You Get - 2 pack 64GB genuine USB 2.0 flash drives, 12-month warranty and lifetime friendly customer service
- Great for All Ages and Purposes – the thumb drives are suitable for storing digital data for school, business or daily usage. Apply to data storage of music, photos, movies and other files
- Easy to Use - Plug and play USB memory stick, no need to install any software. Support Windows 7 / 8 / 10 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, compatible with USB 2.0 and 1.1 ports
- Convenient Design - 360°metal swivel cap with matt surface and ring designed zip drive can protect USB connector, avoid to leave your fingerprint and easily attach to your key chain to avoid from losing and for easy carrying
- Brand Yourself - Brand the flash drive with your company's name and provide company's overview, policies, etc. to the newly joined employees or your customers
Choose an image timeout with its limits in mind
The documented imageTimeout default is 15000 milliseconds. Setting a longer value gives slow image resources more time before html2canvas times out, but it does not guarantee every image will load. The configuration reference says zero disables the timeout. That removes the time limit; it does not cure an invalid URL, a failed request, or a browser origin restriction.
const canvas = await html2canvas(document.querySelector("#capture"), {
imageTimeout: 30000
});
Use a timeout appropriate to the resources and responsiveness your application needs. An unlimited wait can leave a capture pending if a resource never settles. If a missing image is blocked by CORS, increasing the timeout only delays the same failure.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows 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 reinstallHandle cross-origin images with CORS or a proxy
A remote image can be visible in a browser and still be unavailable for canvas export if the server does not permit the required cross-origin access. html2canvas documents useCORS and proxy for this situation, and its FAQ is explicit that it cannot bypass browser content-policy restrictions. See the html2canvas FAQ.
Rank #4
- GOOD VALUE PACKAGE - 1 Pack 32GB Memory Stick USB 2.0 Flash Drives with great cost performance and high quality.
- BIG CAPACITY - The available capacity: 29.10GB-29.8GB, You can save the data of movies, music, photos, designs, programs, manuals, handouts in a high speed.Good performance in digital data storing, transferring and sharing with families, friends, workmates, clients and machines.
- EASY TO USE & PLUG AND WORK - Support windows 7 / 8 / 10 / Vista / XP / 2000 / ME / NT Linux and Mac OS, Compatible with USB2.0 and below.
- TWISTTURN DESIGN & EASY CARRY - The metal clip rotates 360° round the ABS plastic body which with rubber oil skin feeling finish. The capless design can avoid lossing of cap, and providing efficient protection to the USB port.
- WARRANTY & SUPPORT - SIMMAX logo is laser printed on the USB connector surface, our products are of good quality and we promise that any problem about the product within one year since you buy.
Use CORS when the image host allows it
Set useCORS: true when the image server responds with compatible CORS headers for your page’s origin. The option requests images through CORS; it cannot make a server that withholds permission grant access.
const canvas = await html2canvas(document.querySelector("#capture"), {
useCORS: true,
imageTimeout: 15000
});
Use a configured proxy when direct CORS access is unavailable
The configuration also supports a proxy option. It requires a proxy endpoint set up to retrieve the image and return it in the manner html2canvas expects. The project’s Getting Started documentation discusses proxy configuration. A proxy is infrastructure you must configure; the option alone does not create one. Ensure your proxy is restricted appropriately so it cannot be abused to fetch arbitrary resources.
Combine the controls in a complete capture
This example combines an application-level wait for existing image elements, clone-only styling, a finite timeout, and CORS-enabled loading where the remote server permits it. It assumes the page has loaded the html2canvas library and that your page defines the .for-capture class.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
- 【16GB Flash Drive】USB flash drives with 16GB capacity, meet your needs of daily use on work, school, home and travelling for photos, music, videos, files storage and transfer. IMEASON thumb drives can be used to store different files, easy to data backup.
- 【Metal Swivel Cap Design】USB thumb drive is metal swivel cover provides extra protection for the usb thumbdrive connector, no usb drive cap to lose; keychain design makes it easier to carry without worrying lose it.
- 【Wide Compatibility】USB drive supports Windows 7/8/10/11 / Vista / XP / Unix / 2000 / ME / NT Linux and Mac OS, also Supports USB 2.0 and 1.1 ports. USB Stick support TV, desktop, notebook computer, car, audio and other device. The USB Memory Stick is your great data storage and transfer companion with traveling and working.
- 【Easy to use】usb memory stick is plug and play without any software installation. Just simply plug the Flashdrive into the port of your USB-compatible devices such as computer, laptop to start data storage or transmission.
- 【What You Get】16 GB USB Flash Drive Thumb Drive, The default format of the usb storage flash drive is FAT32.
function waitForImages(root) {
const images = Array.from(root.querySelectorAll("img"));
return Promise.all(images.map((img) => {
if (img.complete) return Promise.resolve();
return new Promise((resolve) => {
img.addEventListener("load", resolve, { once: true });
img.addEventListener("error", resolve, { once: true });
});
}));
}
async function captureElement() {
const target = document.querySelector("#capture");
if (!target) throw new Error("Capture element #capture was not found");
await waitForImages(target);
const canvas = await html2canvas(target, {
imageTimeout: 15000,
useCORS: true,
onclone: (clonedDocument) => {
const clonedTarget = clonedDocument.querySelector("#capture");
if (clonedTarget) clonedTarget.classList.add("for-capture");
}
});
document.body.appendChild(canvas);
return canvas;
}
captureElement().catch((error) => {
console.error("Capture failed:", error);
});
If you need a proxy instead of direct CORS access, configure the proxy endpoint for your installation and use the documented proxy option. Do not enable both as a substitute for understanding which origin path is expected to work.
Troubleshoot missing, late, or incorrectly layered images
| Symptom | Likely cause | What to check or change |
|---|---|---|
| An image is absent in the output | Its URL failed, it was not ready, or browser origin policy prevented canvas access. | Check the image request in browser developer tools. If it is slow, wait for application readiness or adjust imageTimeout. If it is cross-origin, verify server CORS headers or configure a proxy. |
| The image appears after the capture has started | The application began capture before assigning or loading the image. | Wait for the application’s own loading state and current image elements before invoking html2canvas. Ensure late-added elements are included in that readiness logic. |
| The image is behind another element | The source DOM, positioning, or stacking styles do not express the desired order for reconstruction. | Correct the markup and CSS stacking/layout, then test the actual capture. There is no documented image-order parameter to override the layout. |
| Increasing the timeout does not help | The failure is not simply a slow request; the URL may be invalid, the request may fail, or CORS may block access. | Inspect the request and response. Fix the URL or server access policy, or use a proxy; do not treat the timeout as a CORS workaround. |
| The result differs from the browser’s visible page | html2canvas reconstructs content from DOM and supported style information rather than taking a native screenshot. | Check whether the relevant CSS is supported and represented in the clone. Reduce the page to a small reproduction when isolating a style mismatch. |
| A capture waits indefinitely | A resource or application readiness condition never settles, or the timeout was disabled with zero. | Use a finite timeout where appropriate, handle image errors in application readiness logic, and ensure loading-state promises can resolve on failure. |
Or skip the browser setup
If you need a screenshot of a URL rather than a canvas generated inside your application, ScreenshotNeo provides a screenshot API and MCP server. Its one-call API can return an image or PDF; see the ScreenshotNeo API documentation for options and response details.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan.
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.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problems

