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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To stop a Google map from moving while you capture a page, initialize the Maps JavaScript API map with gestureHandling: "none", disable the zoom control if it could be used during capture, and prevent your own code from changing the camera until capture finishes. Wait for the intended view and visible tiles to be ready before calling html2canvas. If the live map is missing or inaccurate in the output, use a Google Maps Static API image for the map area instead; a fixed image is generally better suited to a DOM-based capture, but it is not interactive.

What “stop the map moving” means

There are two separate problems that can look alike. First, the map’s view may actually change because of a user gesture, a visible zoom control, or application code. Second, the map may stay put in the browser but fail to appear faithfully in the canvas produced by html2canvas. The first problem calls for locking down map input and camera updates. The second is a rendering and browser-security limitation; a stable view alone cannot guarantee a correct capture.

The Maps JavaScript API setting gestureHandling: "none" prevents panning and zooming through user gestures. Google’s interaction guidance also uses zoomControl: false when the goal is to disable pan and zoom. Do not rely on the older draggable option for this purpose: Google has deprecated it and directs developers to gestureHandling.

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

Lock the map before capture

Set the initial view and disable user controls

Give the map a deliberate center and zoom when constructing it. Disable the zoom control if a user should not be able to change the view during the capture workflow. The gesture setting blocks gesture-based movement; it does not stop your application from calling camera methods.

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

For an existing map, use the Maps JavaScript API’s supported map-options mechanism to apply the relevant options. Make that change before the capture window begins, and verify that the desired center and zoom have already been applied.

Keep application code from changing the camera

During capture, do not initiate panTo, panBy, fitBounds, or another camera update. panTo may animate smoothly, while moveCamera moves immediately to its target; either can make a capture reflect a different view than intended if it runs at the wrong time. Coordinate any application-driven camera updates so they complete before capture begins.

Pay particular attention to fitBounds in layouts that hide the map before showing it. It depends on the map element’s dimensions; when the element is display: none, its size is zero by zero and fitBounds does nothing. Make the map measurable before fitting bounds, then wait for the resulting view and tiles to settle.

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

Wait for the intended map view before calling html2canvas

The Maps JavaScript API’s tilesloaded event fires when visible tiles have finished loading. It is a useful readiness signal, not a lock: it does not prevent later camera changes, guarantee that every application update is complete, or promise that html2canvas will reproduce the map accurately. The bounds_changed event can help diagnose an unexpected viewport change, but it also does not lock the map.

Rank #2
Search+ For Google
  • google search
  • google map
  • google plus
  • youtube music
  • youtube

Use an application-level readiness condition as well as the tile event. In particular, guard against repeated tile events so the same capture is not started multiple times. The following is an illustrative pattern: wire it up after your map and html2canvas library are available, and call captureWhenReady() only after your application has set the final view.

let captureStarted = false;

function captureWhenReady() {
  if (captureStarted) return;
  captureStarted = true;

  const onTilesLoaded = async () => {
    google.maps.event.removeListener(tileListener);

    try {
      const target = document.querySelector("#capture");
      if (!target) throw new Error("Capture element #capture was not found");

      const canvas = await html2canvas(target);
      document.body.appendChild(canvas);
    } catch (error) {
      console.error("Page capture failed:", error);
      captureStarted = false;
    }
  };

  const tileListener = map.addListener("tilesloaded", onTilesLoaded);
}

In production, handle the case where the map has already completed its initial tile load before you attach the listener, and use your own state to decide when the view is final. A tile event can occur again after a later map change; the guard and listener removal above prevent duplicate capture within this one attempt. Add an appropriate timeout or user-visible error path if readiness never arrives rather than waiting indefinitely.

Know what html2canvas can and cannot capture

html2canvas does not take a browser-native screenshot. It traverses page DOM information and builds a representation of the page, which may differ from the browser’s final rendered pixels. Consequently, even a stationary map whose tiles have loaded can be incomplete or inaccurate in the resulting canvas.

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

Browser same-origin rules matter too. html2canvas cannot read the contents of cross-origin iframe documents, and foreign-origin resources or canvases may be unreadable or taint the resulting canvas. Its useCORS and allowTaint options are controls for handling resources; they do not bypass browser security policy. If the map’s rendering path involves inaccessible cross-origin content, turning on one of those options is not a general fix.

Rank #3
Maps For Google
  • get around with real-time traffic information
  • Inspect the captured canvas rather than assuming a successful promise means the map is faithfully present.
  • Check the browser console for loading, access, or canvas errors.
  • Use bounds_changed and your own camera-update code to determine whether the map moved, as distinct from whether the capture omitted it.
  • If the map itself is the unreliable part, replace that area with a Static API image or choose a capture method that captures the rendered browser surface when that is a project requirement.

Choose between a live map and a fixed map image

Approach Interactivity on the page Capture implications Setup and billing
Maps JavaScript API map Interactive map remains available to the page. Can be difficult for a DOM-reconstruction library to reproduce faithfully; locking its view does not remove cross-origin constraints. The cited documentation does not establish setup or billing details for this comparison.
Google Maps Static API image The map portion is a fixed image, not an interactive map. A conventional image resource is a more dependable fit for a page-image capture workflow; surrounding DOM can still be captured as part of the selected region. Requires an API key and billing enabled for the Google Cloud project.

The Static API lets an HTTP request specify location, dimensions, zoom, map type, and optional markers. Use it when the capture needs a dependable fixed map image and the loss of map interaction in that composition is acceptable. Keep the live map on the page for users if needed, while rendering a static counterpart in the capture-specific composition.

Common problems and fixes

The map still pans or zooms

Confirm that the map was created or updated with gestureHandling: "none". Hide the zoom control if it is present, and audit event handlers or application state changes that call camera methods. This setting addresses user gestures, not programmatic movement.

The captured map shows the wrong center or zoom

Look for camera updates that run after your capture workflow starts, including animated panTo calls or a late fitBounds. Set the intended view first, ensure the map element has a nonzero size if fitting bounds, then wait for visible tiles before invoking html2canvas. Use bounds_changed while diagnosing unexpected viewport changes.

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.

The map is blank, partial, or different in the canvas

That is not necessarily a movement issue. html2canvas reconstructs from DOM information rather than taking a native screenshot, and browser cross-origin protections may prevent access to map content. Check the console and canvas output; do not treat useCORS or allowTaint as security-policy workarounds. For a fixed image in the capture, use the Static API.

Rank #4
Europe GPS Map 2027 for Garmin Devices on microSD
  • Latest version - updated June 2026 Locate hotels, restaurants and attractions Find points of interest and routes and turn-by-turn voice directions Plug & Play Operation Works with virtually ALL Garmin devices

Capture never starts or starts more than once

A listener attached after the relevant load event may wait without completing, while unguarded repeated tilesloaded events can trigger duplicate captures. Attach readiness logic as part of your map lifecycle, account for an already-ready map using application state, remove the listener after the capture attempt, and guard the attempt with a one-shot flag. Provide a timeout and error handling for a failed or stalled page.

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

Or skip the browser setup

If the goal is a screenshot of the page rather than testing your own html2canvas composition, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API returns an image or PDF from a URL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo API documentation for the request options. You can also call it from Python:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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)

Or from 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}`);
  • It accepts cookie or consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Response headers identify the page verdict and billing status.
  • Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Every feature is on every plan.

Sign up for ScreenshotNeo and get 1,000 screenshots a month free with no card.

Best Value
WonVon 5 Inch Motorcycle Carplay GPS Navigation System with Apple Carplay and Android Auto Portable Screen with Dual Bluetooth, Navigation, Siri, Google Assistant(Not Inchluded TPMS)
  • Seamless Wireless CarPlay Experience: Stay fully connected with wireless CarPlay, enabling hands-free navigation, calls, music, and voice commands—perfect for urban riders and touring enthusiasts
  • Android Auto for Every Adventure: Streamlined Android Auto for motorcycle support offers real-time GPS, voice-activated control, Bluetooth sync, music streaming, and app access for safer rides
  • 5-Inch IPS Display Built for Riding: Crisp 5-inch IPS touchscreen with 854x480 resolution, anti-glare view, sunlight readability, glove-friendly operation, and night mode display designed for bikers
  • Bluetooth Stereo with Immersive Audio: Enjoy premium motorcycle stereo system with Bluetooth headset pairing, hands-free calls, stable signal, surround sound, and ride-safe voice clarity
  • Waterproof and Weatherproof Ruggedness: IP-rated rugged housing ensures rainproof durability, dust resistance, mud protection, secure mount stability, and reliable function in all conditions

FAQ

Does gestureHandling: "none" stop my own JavaScript from moving the map?

No. It blocks user-gesture panning and zooming; your code must avoid camera updates during capture.

Does tilesloaded guarantee a correct html2canvas result?

No. It signals that visible map tiles have finished loading. It does not make html2canvas a native screenshot tool or override cross-origin restrictions.

Can I keep the map interactive and capture a static map instead?

Yes. A capture-specific composition can use a Static API image in place of the live map while the rest of the page remains part of the capture region. The image itself is not interactive.

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

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.