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

To keep a Google map from moving while you capture a page with html2canvas, initialize the Maps JavaScript API map with gestureHandling: "none". Turn off zoomControl if the visible zoom buttons could change the view, and do not call camera-changing methods while capture is underway. Wait until your application has applied the desired center and zoom and the map’s tilesloaded event has fired before capturing.

That stabilizes map interaction and capture timing; it does not guarantee html2canvas can reproduce Google Maps correctly. html2canvas rebuilds an image from page information rather than taking a browser-native screenshot, and cross-origin content may be inaccessible. If fidelity matters more than interactivity in the captured image, use a Google Maps Static API image for the map area instead.

Stop gestures from panning or zooming the map

For a map created with the Google Maps JavaScript API, set gestureHandling to "none". Google documents that this prevents panning and zooming through user gestures. If users could also change the zoom with the on-map buttons, set zoomControl: false.

const map = new google.maps.Map(document.getElementById("map"), {
  center: { lat: 37.422, lng: -122.084 },
  zoom: 14,
  gestureHandling: "none",
  zoomControl: false
});

Use the options when you initialize the map, or update an existing map using its supported options mechanism. The older draggable option is deprecated for disabling this kind of interaction; use gestureHandling: "none" instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

These settings prevent user input from changing the view; they do not freeze application code. A call to panTo, panBy, fitBounds, or another camera-changing method can still move the map. Make sure your app has settled on the intended center and zoom before starting capture, and do not issue further camera updates until it is done.

Wait for the intended view before calling html2canvas

The Maps JavaScript API’s tilesloaded event fires when visible map tiles have finished loading. Use it as a readiness signal, not as a lock: it does not prevent later camera changes or guarantee that html2canvas will render the map faithfully. The bounds_changed event can help diagnose an unexpected viewport change.

Here is a guarded example that waits for the map’s first tile load, captures once, and applies a timeout so the page does not wait forever if the event never arrives. Load the Google Maps JavaScript API and html2canvas on the page before running this code. Call captureMapRegion after your application has finished setting the map view.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const mapElement = document.getElementById("map");
const captureElement = document.getElementById("capture");

const map = new google.maps.Map(mapElement, {
  center: { lat: 37.422, lng: -122.084 },
  zoom: 14,
  gestureHandling: "none",
  zoomControl: false
});

function waitForTilesLoaded(map, timeoutMs = 20000) {
  return new Promise((resolve, reject) => {
    let settled = false;
    let timer;

    const listener = map.addListener("tilesloaded", () => {
      if (settled) return;
      settled = true;
      clearTimeout(timer);
      listener.remove();
      resolve();
    });

    timer = setTimeout(() => {
      if (settled) return;
      settled = true;
      listener.remove();
      reject(new Error("Timed out waiting for map tiles"));
    }, timeoutMs);
  });
}

async function captureMapRegion() {
  await waitForTilesLoaded(map);
  const canvas = await html2canvas(captureElement);
  document.body.appendChild(canvas);
  return canvas;
}

captureMapRegion().catch((error) => {
  console.error("Capture failed:", error);
});

The listener is installed before waiting, so it will catch the next tilesloaded event. If your app can finish loading the map before this function runs, arrange the capture sequence so it subscribes in time or otherwise track readiness in your own map lifecycle. A tile event only tells you about visible tiles at that point; if your app changes the view afterward, wait again for the new view before capturing.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Give the map element a nonzero size before asking the API to fit its bounds. Google documents that fitBounds does nothing when the map is display: none, because the element measures 0 by 0. If you need to prepare a hidden capture region, make it measurable rather than fully hidden, or set the final center and zoom after it becomes visible.

Understand why a stable live map can still capture badly

html2canvas traverses the DOM and builds a representation from page information; it does not take an actual screenshot of the browser’s final rendered surface. Its output can therefore differ from what a person sees on screen. Preventing map motion solves only one part of the problem: it does not make every map layer available to the library.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Browser same-origin rules also matter. html2canvas cannot access cross-origin iframe documents, and foreign-origin resources or canvases may be unreadable or taint the resulting canvas. Its useCORS and allowTaint settings are controls for handling resources; they do not bypass browser security policy. Enabling useCORS: true is not a general fix for missing Google Maps content.

After capture, inspect the canvas and the browser console. If the map is missing, incomplete, or different from the visible browser page, treat that as a rendering or cross-origin limitation rather than evidence that the map moved. Verify the actual page, browser, map rendering behavior, and resource access in your project; success with one setup does not establish that every browser and page will behave the same way.

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

Choose between a live map and a fixed map image

If the captured composition needs a dependable map image, Google Maps Static API is the documented alternative: it returns an image from an HTTP request, with parameters for location, dimensions, zoom, map type, and optional markers. Use that image in the capture region in place of the live interactive map. It can make the map portion easier to include as an ordinary page image, but the captured composition is no longer interactive.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Approach Interactivity Capture considerations Setup
Maps JavaScript API with html2canvas The map remains interactive on the page, subject to the interaction settings you choose. html2canvas reconstructs page content and may not reproduce the live map faithfully; cross-origin restrictions can affect resources. Configure the map and sequence capture after the intended view is ready.
Google Maps Static API image The supplied map image is fixed, not an interactive map. An image is a conventional page resource and can be included in the capture region alongside surrounding DOM content. Requires an API key and billing enabled for the Google Cloud project.

Choose the live map when interaction on the page is part of the requirement and the captured output can tolerate project-specific verification. Choose the static image when a fixed map appearance is the goal. You can also keep the live map for visitors and substitute a static image only in a dedicated capture layout.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common capture problems

  • The map pans or zooms when a user interacts. Set gestureHandling: "none". Also disable zoomControl if the visible controls could change the zoom.
  • The map changes during capture even with gestures disabled. Search application code for camera updates such as panTo, panBy, or fitBounds. Pause those updates during the capture window and confirm the final view before waiting for tiles.
  • The result contains blank or missing map content. Check the browser console and inspect whether cross-origin resources or an iframe are involved. Do not assume useCORS or allowTaint bypasses browser security restrictions; consider substituting a Static API image.
  • The capture starts before the map is ready. Wait for tilesloaded after the intended center and zoom are applied. Add a timeout and report the failure instead of leaving a capture request pending indefinitely.
  • fitBounds has no effect. Check the map element’s size. If it is display: none, Google documents that its zero-by-zero dimensions prevent fitBounds from working; apply bounds after it has a nonzero size.
  • Surrounding page content captures but the map does not. That can happen because html2canvas reconstructs the DOM and is constrained by browser security and resource access. Isolate the map region for diagnosis, then use a static image or another method that captures the rendered browser surface if that is a project requirement.

Or skip the browser setup

If you need a screenshot of a page rather than a canvas generated inside your own app, ScreenshotNeo offers a website screenshot API and MCP server. Its one-call API accepts a URL and can return a screenshot or PDF. It removes cookie banners, popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000.

For API parameters and options, see the ScreenshotNeo documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://your-site.example/map-page 
  -o shot.webp

This captures the page URL through the API; it is an alternative to setting up an in-page html2canvas flow, not a claim that every live Google map will render identically in every capture. Sign up for 1,000 free screenshots a month with no card.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

FAQ

Does gestureHandling: "none" prevent my application from moving the map?

No. It disables user gesture-based panning and zooming. Your code can still change the camera, so pause camera updates during capture.

Does tilesloaded guarantee the captured map will be accurate?

No. It signals that visible tiles have finished loading, but html2canvas rendering and browser security constraints can still affect the output.

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.

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.