October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Canvas API

How to Trigger a Website Screenshot Download (Canvas, Screen Capture, and APIs)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the method that matches where the screenshot pixels come from. If your page already draws the image in a <canvas>, export it with toBlob(), create a temporary object URL, and click an anchor with a download filename. If you need the actual browser display, call getDisplayMedia(); the user must choose a tab, window, or screen and approve the prompt. If the target is an arbitrary URL or a server-rendered page, use browser automation or a hosted screenshot API instead of trying to capture a visitor’s page silently.

Choose the screenshot architecture first

Route Use it when Interaction Main limitation
Canvas export The pixels already exist in your page’s canvas A button can start the download Canvas must remain origin-clean; browser download behavior still applies
getDisplayMedia() You need pixels from a selected tab, window, or display Source picker and permission are mandatory Support varies and capture cannot be silent
DevTools screenshot A developer is manually debugging a page The developer operates browser tooling Not a feature that visitors can invoke from your site
Hosted screenshot API Your server needs a screenshot of a URL or rendered HTML Your application calls an endpoint Adds a service dependency and is a different architecture

Make a canvas download as PNG

This is the shortest reliable path when your application already rendered the screenshot into a canvas. HTMLCanvasElement.toBlob() encodes the canvas asynchronously. PNG is required by browsers and is used when the requested type is unsupported or omitted.

Complete button example

<canvas id="shot" width="1200" height="800"></canvas>
<button id="download-shot" type="button">Download screenshot</button>
<a id="fallback-link" hidden>Save screenshot</a>

<script>
const canvas = document.querySelector('#shot');
const button = document.querySelector('#download-shot');
const fallback = document.querySelector('#fallback-link');
let activeUrl;

button.addEventListener('click', () => {
  canvas.toBlob((blob) => {
    if (!blob) {
      throw new Error('Could not encode the screenshot');
    }

    if (activeUrl) URL.revokeObjectURL(activeUrl);
    activeUrl = URL.createObjectURL(blob);

    const link = document.createElement('a');
    link.href = activeUrl;
    link.download = 'screenshot.png';
    link.click();

    // Keep a visible link in case the browser opens or prompts instead.
    fallback.href = activeUrl;
    fallback.download = 'screenshot.png';
    fallback.hidden = false;
  }, 'image/png');
});

window.addEventListener('pagehide', () => {
  if (activeUrl) URL.revokeObjectURL(activeUrl);
});
</script>

The download value is a filename suggestion and an intent signal, not a guarantee. Browser settings, response headers, and user prompts can cause the image to open or be saved under another name. Keeping a visible link gives the user another action if a programmatic click is ignored.

JPEG, WebP, and quality

Pass a MIME type as the second argument and, for lossy formats, a quality value between 0 and 1:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Guermok Video Capture Card, 4K USB3.0 HDMI to USB C, 1080P 60FPS & 2K 30FPS
  • 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
  • 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
  • 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
  • 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
  • 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
canvas.toBlob((blob) => {
  if (!blob) return;
  const url = URL.createObjectURL(blob);
  const link = document.createElement('a');
  link.href = url;
  link.download = 'screenshot.webp';
  link.click();
  // Revoke after the link is no longer needed.
}, 'image/webp', 0. nueve);

Replace the accidental placeholder in any copied example with a numeric quality such as 0.9. PNG is lossless and usually best for UI text; JPEG or WebP can produce smaller photographic files. Check the returned Blob type if a browser does not support your requested format.

Why not use toDataURL()?

toDataURL() constructs a potentially very large string. For large canvases that consumes more memory and can hit URL-length limits. toBlob() plus an object URL avoids that string conversion. Revoke object URLs only after the user can no longer access the generated file; revoking immediately after click() can make a still-visible link unusable.

Capture the live display with getDisplayMedia()

Use the Screen Capture API when the required pixels are the browser’s current display rather than a canvas you control. The call must happen after recent user interaction, in a secure context (HTTPS), and the browser always presents a source picker and permission prompt. A Permissions Policy does not remove that prompt.

Rank #2
Video Capture Card, 4K USB3.0 HDMI to USB C, 1080P60FPS HDMI Capture Card for Streaming, Gaming, Video Recording Compatible with Switch, Xbox, PS4/5, OBS,iPad Mac OS Windows,Camera, Zoom(Silver)
  • 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
  • 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
  • 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
  • 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
  • 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.

Capture one frame and download it

<button id="capture" type="button">Capture selected screen</button>
<script>
const captureButton = document.querySelector('#capture');

captureButton.addEventListener('click', async () => {
  let stream;
  let bitmap;
  try {
    stream = await navigator.mediaDevices.getDisplayMedia({
      video: true,
      audio: false
    });

    const track = stream.getVideoTracks()[0];
    const imageCapture = new ImageCapture(track);
    bitmap = await imageCapture.grabFrame();

    const canvas = document.createElement('canvas');
    canvas.width = bitmap.width;
    canvas.height = bitmap.height;
    canvas.getContext('2d').drawImage(bitmap, 0, 0);

    const blob = await new Promise((resolve, reject) => {
      canvas.toBlob((value) => value ? resolve(value) : reject(new Error('Encoding failed')), 'image/png');
    });

    const url = URL.createObjectURL(blob);
    const link = document.createElement('a');
    link.href = url;
    link.download = 'display-capture.png';
    link.click();

    // Keep the URL while a user-facing link can still be used.
    setTimeout(() => URL.revokeObjectURL(url), 60_000);
  } catch (error) {
    if (error.name === 'NotAllowedError') {
      console.error('The user cancelled or denied screen capture.');
    } else {
      console.error('Screen capture failed:', error);
    }
  } finally {
    if (bitmap) bitmap.close();
    if (stream) stream.getTracks().forEach((track) => track.stop());
  }
});
</script>

Stopping every track after grabbing the frame releases the capture indicator and camera/screen resources. Do not describe this as a silent screenshot feature: the user sees and controls what is shared.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Display-capture constraints you cannot bypass

  • Availability is not uniform across browsers or mobile environments; feature-detect navigator.mediaDevices?.getDisplayMedia and provide an explanation when it is absent.
  • The browser, not your page, controls which surfaces appear in the picker. The Screen Capture specification does not let a site narrow the user’s choices to one particular tab or window.
  • A denied prompt, cancellation, or missing secure context must be treated as a normal branch with a retry or manual-save path.
  • Extension-only tab-capture APIs and DevTools commands are not equivalent to capabilities granted to an ordinary web page.

When canvas export fails: origin and download rules

Fix a tainted canvas

If you draw an image from another origin without permission, the canvas becomes non-origin-clean. Calls to toBlob() or toDataURL() then throw a SecurityError. Set the image request’s CORS mode before assigning its source and configure the image server to return an appropriate Access-Control-Allow-Origin header:

const image = new Image();
image.crossOrigin = 'anonymous';
image.onload = () => {
  const ctx = canvas.getContext('2d');
  ctx.drawImage(image, 0, 0);
};
image.src = 'https://images.example.test/page.png';

Both sides matter: a client-side crossOrigin setting cannot grant access when the remote response omits the required CORS header. If you do not control that server, proxy the asset through a server you control while respecting its terms and security requirements.

Rank #3
Capture Card, 4K HDMI Video Capture Card, Game Capture Card, 1080P 60FPS Video Capture Device, HDMI to USB 3.0 Capture Card for Streaming, Work with Camera/Xbox/PS4/PS5/PC/OBS
  • 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
  • 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
  • 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
  • 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
  • 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.

Why an HTTP URL will not always download

An anchor’s download attribute works for same-origin URLs and for blob: and data: URLs. It cannot force an arbitrary cross-origin HTTP resource to download. For a remote file, return it from your own origin with suitable headers, or fetch it and create a Blob URL when CORS permits the fetch. The final filename can still be changed by browser settings, user prompts, or Content-Disposition.

Server-side screenshots and arbitrary URLs

A visitor-side button cannot reliably render an unrelated URL, bypass a login, or capture a page that is not present in the current browser. Use browser automation or a hosted screenshot service when your application needs a URL rendered on a server. This also avoids asking every visitor for display permission and gives you a place to set viewport, cookies, headers, wait conditions, and output format.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie/consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.

Here is a complete cURL request (see the ScreenshotNeo documentation for all parameters):

Rank #4
Audio Express AXHDCAP 4K HDMI Video Capture Card, Cam Link Card Game Audio Adapter HDMI to USB 2.0 Record Capture Device for Streaming, Live Broadcasting, Video Conference, Teaching, Gaming
  • [Enhanced 4K-1080P Video Capture Experience] Capture the Magic: Elevate your video recordings to new heights with our upgraded anti-static 1080P Video Capture Card. Immerse yourself in stunning visuals, supporting HDMI input at 4K 60FPS and USB output for capturing in 1080P, complete with rich stereo sound. Enjoy crystal-clear video recordings, dynamic gaming live streams, and professional conference broadcasts. Note: HDMI resolution: Max input can be 3840×2160@30Hz / Video output resolution: Max output can be 1920×1080@30Hz
  • [Seamless Real-Time Preview] Stay in the Moment: Our advanced ultra-low latency technology ensures seamless real-time transmission of video streams. Experience instant, lag-free previews, allowing you to capture every detail precisely. Effortlessly record video directly to your hard disk, all without compromising on quality or introducing any delays.
  • [Versatility and Broad Compatibility] Your Creative Hub: Connect your DSLR, camcorder, or action camera to a wide range of operating systems, including Windows, MacOS, and Linux. Unlock a world of possibilities with real-time streaming to popular platforms like Twitch, Youtube, OBS, Zoom, Potplayer, and VLC, giving you the tools to share your content effortlessly.
  • [Effortless Plug and Play] Simplicity Redefined: Say goodbye to complex installations. Our plug-and-play design eliminates the need for drivers or external power supplies. Seamlessly integrate high-definition acquisition into various scenarios, whether it's educational recordings, immersive gaming, precise medical imaging, captivating live streams, or professional broadcasting.
  • [Seize Every Detail with Precision] Unleash your creativity and attention to detail with our video capture card. Capture every nuance, every color, and every moment with precision, thanks to the enhanced capabilities of our technology. Whether you're a content creator, a gamer, or a professional, our capture card empowers you to seize the finest elements and bring them to life in your recordings and live streams.
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 is:

import requests
r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

For AI workflows, its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients. Options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or custom viewports, retina scale, PDF paper and page controls, HTML/CSS rendering, custom JavaScript and CSS, pre-capture clicks, selector hiding, selector/delay/network-idle waits, request and resource blocking, headers, cookies, user agents, Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed public-image links, async jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Common parameter names from other screenshot APIs are accepted to ease migration.

Every feature is included on every plan: 1,000 shots per month free with no card, then Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000. Yearly billing gives two months free. Create a free ScreenshotNeo account to start with the 1,000 monthly shots.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting checklist

The click does nothing

  • Make the click originate from a real user action; popup and download protections may reject delayed or synthetic events.
  • Check that the Blob is non-null and that the object URL is assigned before clicking.
  • Leave a visible link so the user can activate the save manually.

SecurityError during export

Find every image or video drawn into the canvas. A single cross-origin resource without successful CORS makes the whole bitmap tainted. Add the correct CORS response, proxy the resource, or keep the foreign pixels out of the export.

Best Value
acer Video Capture Card HDMI to USB 3.0, 1080P 60FPS/2K 30FPS for Streaming
  • 【1080P 60FPS & 2K 30FPS】Supports HDMI input up to 4K 30FPS for ultra‑clear source signals, and captures/streams smooth footage at max 1080P 60FPS or 2K 60FPS to eliminate motion blur and stuttering, delivering fluid visuals for gaming, live streaming and video recording via high‑speed USB 3.0 transmission.
  • 【USB 3.0 High-Speed Interface】USB 3.0 interface with up to 5Gbps bandwidth for lag-free HD capture and streaming with consoles, cameras, desktops, and laptops. Aluminum casing dissipates heat effectively, ensuring stable performance under prolonged high-bandwidth loads. Note: For best results, use a USB 3.0 port.
  • 【Easy Plug-and-Play design】with no additional driver software required. The 2-in-1 USB-A & Type-C interface design ensures wide compatibility with laptops, desktops, gaming consoles and mobile devices. Its compact and lightweight construction enhances portability, allowing you to carry and use it effortlessly anytime and anywhere.
  • 【Wide Universal Compatibility】Works with diverse devices: laptops, tablets, PS4/PS5, Nintendo Switch, cameras, TV boxes, and Oculus Quest 2/3. It supports major operating systems: Windows 7/8/8.1/10, Mac OS, Linux, Android, and iPadOS 17+. Fully compatible with popular software and streaming platforms like OBS Studio, QuickTime Player, TikTok, Twitch, and YouTube—all without requiring drivers.
  • 【Worry-Free After-Sales Support】Whether you're a newcomer or a seasoned user, feel free to reach out anytime with any questions—your satisfaction is our top priority. NOTE: This capture card supports one-way transmission only (HDMI to USB), and ensure your device is equipped with a USB 3.0 port to achieve optimal performance.

The file is blank or incomplete

Wait until fonts, images, and drawing operations finish before calling toBlob(). For display capture, grab the frame only after the selected track is live, then stop the tracks in finally.

The screen picker is unavailable

Serve the page over HTTPS, call the API from a recent user gesture, and feature-detect support. Explain that the user must select a source; there is no permission-free fallback for live display pixels.

Large screenshots freeze the tab

Prefer toBlob() to toDataURL(), avoid unnecessary duplicate canvases, and release object URLs and ImageBitmap objects when finished. For very large or repeated jobs, move rendering to a server-side browser or screenshot API.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Production considerations

  • Choose the output format deliberately: PNG preserves interface text and transparency; JPEG and WebP can reduce photographic payloads.
  • Use deterministic filenames, but treat them as suggestions rather than promises.
  • Do not revoke a URL while a visible link still depends on it; revoke it on replacement, removal, or page teardown.
  • Tell users exactly which tab, window, or display will be captured and provide a clear cancel path.
  • For server captures, handle timeouts, bot checks, blank pages, authentication, and cache behavior explicitly instead of retrying blindly.

Frequently Asked Questions

Can a webpage take a screenshot without asking the visitor?

Not of the visitor’s live tab, window, or display. getDisplayMedia() requires a source picker and permission. A page can silently export only pixels it already owns, such as a same-page canvas.

What is the safest filename to provide?

Use a simple extension matching the encoded type, such as screenshot.png. The browser may still alter the name or ask where to save it.

Should I use a data URL for a screenshot?

For large images, no. Encode with toBlob() and use an object URL to avoid the memory and URL-length costs of a large data-URL string.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.