Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
9 views1 page

Google Map Api

Uploaded by

mavyasrimahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

Google Map Api

Uploaded by

mavyasrimahi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

// function initMap() {

// // Try HTML5 geolocation to get the user's current location


// if (navigator.geolocation) {
// navigator.geolocation.getCurrentPosition(position => {
// const userLocation = {
// lat: position.coords.latitude,
// lng: position.coords.longitude
// };

// // Create the map centered at the user's location


// const map = new google.maps.Map(document.getElementById("map"), {
// zoom: 12,
// center: userLocation
// });

// // Add a marker for the user's location


// new google.maps.Marker({
// position: userLocation,
// map: map,
// title: "You are here!"
// });
// }, () => {
// handleLocationError(true);
// });
// } else {
// // Browser doesn't support Geolocation
// handleLocationError(false);
// }
// }

// function handleLocationError(browserHasGeolocation) {
// const errorMessage = browserHasGeolocation
// ? "Error: The Geolocation service failed."
// : "Error: Your browser doesn't support geolocation.";
// alert(errorMessage);
// }

You might also like