Skip to main content
Pure helpers work well in browsers because they do not need Node-only APIs.
import { isGoogleMapsUrl, parseGoogleMapsUrl } from "google-maps-link-parser";

const userInput = "https://www.google.com/maps/@24.7136,46.6753,15z";
if (!isGoogleMapsUrl(userInput)) {
  throw new Error("Not a supported public Google Maps URL");
}

const parsed = parseGoogleMapsUrl(userInput);
console.log(parsed.intent); // => "coordinates"
console.log(parsed.location.value);
Output
{ latitude: 24.7136, longitude: 46.6753, source: "at-pattern", accuracy: "exact" }
Network unfurling and provider enrichment in the browser may have CORS and key-exposure implications. Prefer server-side unfurling and enrichment when practical.