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

To refresh a webcam snapshot without reloading the page, keep one <img> element and assign it a new image URL on a timer. Add a changing query parameter, such as the current timestamp, so caches do not keep returning the old image. Use setInterval() for a simple fixed schedule; use a recursive setTimeout() loop when each request must finish before the next one begins.

Refresh only the webcam image

This example updates the image every 10 seconds. The page and its other resources stay in place. The first refresh happens after the first 10-second delay; call refreshSnapshot() before starting the timer if you want to request a fresh frame as soon as the script runs.

<img id="webcam" src="/camera/latest.jpg" alt="Latest webcam snapshot" width="640" height="480">

<script>
  const image = document.getElementById('webcam');
  const baseUrl = '/camera/latest.jpg';
  const refreshMs = 10_000;

  function refreshSnapshot() {
    image.src = `${baseUrl}?t=${Date.now()}`;
  }

  // Uncomment this line to request a fresh frame immediately.
  // refreshSnapshot();

  const intervalId = setInterval(refreshSnapshot, refreshMs);

  // Call clearInterval(intervalId) when this page or component no longer needs updates.
</script>

Replace /camera/latest.jpg with the actual snapshot endpoint. If that URL already has query parameters, append the timestamp with &t= rather than adding a second question mark. For example, /camera/latest.jpg?view=outdoor&t=....

Choose a refresh period the camera can support

The timer controls how often the browser requests an image, not how often the camera publishes a new one. If the camera updates every 30 seconds, polling every 2 seconds mostly downloads duplicate frames. Match the interval to the camera’s publication cadence and the bandwidth you can use. A shorter interval also means more requests to the camera server, proxy, or CDN.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
  • Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
  • Built-In Mic: The built-in microphone lets others hear you clearly during video calls
  • Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works

setInterval() repeatedly invokes its callback after a fixed delay. The delay is not a guarantee that an image will finish downloading in that time. If a request lasts longer than the interval, another request can start while it is still pending. For a responsive endpoint and a simple page this may be acceptable; when overlap is undesirable, use the sequential pattern below.

Prevent overlapping refresh requests

A recursive setTimeout() schedules the next request only after the current fetch has completed. This makes the interval effectively “wait this long after the last request finishes,” rather than “start every fixed number of milliseconds.” It is useful when network time varies or the camera server is slow.

<img id="webcam" src="/camera/latest.jpg" alt="Latest webcam snapshot" width="640" height="480">
<p id="webcam-status" role="status">Loading latest snapshot…</p>

<script>
  const image = document.getElementById('webcam');
  const status = document.getElementById('webcam-status');
  const baseUrl = '/camera/latest.jpg';
  const refreshMs = 10_000;
  let stopped = false;
  let timerId;
  let currentObjectUrl;

  async function poll() {
    try {
      const url = `${baseUrl}?t=${Date.now()}`;
      const response = await fetch(url, { cache: 'no-cache' });
      if (!response.ok) throw new Error(`HTTP ${response.status}`);

      const blob = await response.blob();
      if (!blob.type.startsWith('image/')) {
        throw new Error('The endpoint did not return an image');
      }

      const nextObjectUrl = URL.createObjectURL(blob);
      image.onload = () => {
        if (currentObjectUrl) URL.revokeObjectURL(currentObjectUrl);
        currentObjectUrl = nextObjectUrl;
        status.textContent = `Updated ${new Date().toLocaleTimeString()}`;
      };
      image.onerror = () => {
        URL.revokeObjectURL(nextObjectUrl);
        status.textContent = 'Could not display the latest snapshot; showing the previous frame.';
      };
      image.src = nextObjectUrl;
    } catch (error) {
      status.textContent = 'Could not load the latest snapshot; showing the previous frame.';
      console.error('Webcam snapshot refresh failed:', error);
    } finally {
      if (!stopped) timerId = setTimeout(poll, refreshMs);
    }
  }

  poll();

  // Run this when tearing down the page component.
  function stopPolling() {
    stopped = true;
    clearTimeout(timerId);
    if (currentObjectUrl) URL.revokeObjectURL(currentObjectUrl);
  }
</script>

This pattern fetches the image as a blob and changes the displayed source only after a successful response. That lets a failed request leave the previous good frame visible. The role="status" text communicates the update or failure to assistive technology. If you use a single img.src assignment instead, browsers may replace the displayed frame with a broken-image indicator if the new URL fails.

Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
  • The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
  • C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
  • The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.

When direct image assignment is enough

Use the shorter setInterval() example if the endpoint reliably returns an image and occasional overlapping downloads are not a concern. It has less code and does not need JavaScript to read the response body. Use fetch() when you need to inspect HTTP status, validate the response, preserve the previous frame on failure, or report a useful status message.

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

The fetch version has a cross-origin constraint: if the camera is on another origin, its server must permit the browser’s cross-origin fetch. An image element can often display a cross-origin image even when JavaScript is not allowed to read its response. If you cannot configure the camera server’s cross-origin policy, route the request through your own server rather than trying to bypass the browser’s security rules.

Why a changed image URL can still show a stale frame

Browsers and intermediary caches may reuse an image response when the URL has not changed. A timestamp query parameter such as ?t=... gives each refresh a distinct URL, which is a straightforward cache-busting technique. It is especially useful when the camera endpoint always serves the newest frame from one stable path but does not provide cache behavior suitable for frequent polling.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
  • 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
  • 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
  • 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.

Cache busting has a cost: every unique URL can be treated as a new request and may reach the origin or a proxy rather than reusing a cached response. At scale, coordinate the browser code with the camera endpoint and any reverse proxy or CDN. The server can send Cache-Control: no-cache to ask caches to revalidate before reuse. Cache-Control: no-store prevents storing the response, but can increase origin traffic. Neither header can make the camera publish new frames more frequently than it actually does.

  • If the frame stays stale, verify that the timestamp is changing and that the endpoint accepts query parameters.
  • If a proxy or camera software ignores query strings in its cache key, configure its cache behavior or use server-side cache headers.
  • If the endpoint generates a different URL for each frame, use the camera-provided URL pattern rather than inventing query parameters it does not support.

Do not use whole-page refresh for an image-only update

<meta http-equiv="refresh" content="10"> reloads the entire document after the specified delay. It may suit a deliberately kiosk-like page with no state to preserve, but it also reloads other page resources and resets page state such as form contents or expanded panels. Frequent automatic page refreshes can disorient people and may not give screen-reader users enough time to finish reading. Updating only the image is generally the more considerate approach.

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

Make the refresh accessible and stable

  • Describe the image. Use meaningful alt text, such as “Latest snapshot of the north entrance camera.” Do not describe it as live video if it is a still image.
  • Set dimensions. Explicit width and height reserve space and prevent layout shifts when new frames load.
  • Show freshness when it matters. A visible last-updated time helps a visitor distinguish a new frame from a stalled camera. Update it only after an image has loaded successfully.
  • Stop work that is no longer needed. Call clearInterval() for an interval timer or clear the pending timeout and mark the poller stopped. Framework components should do this during teardown; pages can also stop polling when the relevant view is hidden.
  • Keep failures visible but calm. Preserve the last good image and show a concise status rather than replacing it with an error frame or silently suggesting it is current.
  • Respect the endpoint. Poll no faster than the actual publication cadence calls for, and account for the number of visitors who may open the page at once.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common problems

The image never changes

Check the browser’s Network panel to see whether a new request is sent at each interval and whether the request URL has a changing timestamp. If no request appears, confirm the script runs after the image exists and check the browser console for JavaScript errors. If requests appear but the bytes or frame remain identical, the camera may not have published a new snapshot, or a proxy may be ignoring the query string.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera
  • 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
  • Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
  • Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
  • Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
  • High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)

The image breaks after the first refresh

Confirm that the new URL returns an image rather than an HTML error page, login screen, or redirect destination. In the fetch pattern, inspect the HTTP status and response content type; a successful HTTP response is not necessarily an image. Keep the old frame until a valid new image has loaded.

Fetch reports a cross-origin error

The camera server must allow the page’s origin to make a cross-origin fetch. Configure the endpoint’s CORS response if you control it. Otherwise, have a server you control request the snapshot and serve it to the page. Do not add permissive settings to the browser as a workaround; browser security protections are intentional.

The server gets too many requests

Increase the interval, stop polling when the image is off-screen or the page is hidden, and consider serving a cached snapshot through a proxy with an expiration aligned to the camera’s update cadence. Remember that a unique timestamp URL is designed to avoid reuse of a cached image; that can increase traffic if each visitor polls independently.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
  • Compatible with Nintendo Switch 2’s new GameChat mode
  • HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
  • Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
  • Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
  • Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video

Requests pile up or frames arrive out of order

Use the recursive timeout approach so the next request starts after the previous fetch completes. A fixed interval can initiate another request before the prior one finishes, particularly on a slow connection. Also avoid setting the interval shorter than the server’s typical response time unless concurrent requests are deliberate.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server, not a webcam streaming service. It can capture a webpage that displays a snapshot; to keep a page’s image current, the page still needs to obtain updated frames from its camera endpoint. For an on-demand page capture, make one request to the API; see the ScreenshotNeo API documentation for options.

Quick Recap

SaleBestseller No. 1
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Built-In Mic: The built-in microphone lets others hear you clearly during video calls
$35.90
SaleBestseller No. 2
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black
Compatible with Nintendo Switch 2’s new GameChat mode
$16.89
Bestseller No. 5
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black
Compatible with Nintendo Switch 2’s new GameChat mode; Fully compatible with Windows 11
$69.99
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Replace the example target with your page URL. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Visit ScreenshotNeo or sign up free.

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.