Yeah thank you Barry. I want to know if i could use this 2 functions (geolocation and addmarker) together on the google map api javascript, because the geolocation function not working when there are add marker function on the same code.
On Sat, Mar 2, 2019 at 2:04 AM Barry Hunter <barrybhun...@gmail.com> wrote: > Do you mean the browser Geolocation API? > https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API > > ... ie find the visitors location, and then let them create a Marker at > that location? > > Or maybe mean just show a fancy marker to 'show' the user their location? > > ... in short yes, should be able to use Geolocation API with the Maps API > > Something like this kinda demonstrates what would do... > > navigator.geolocation.getCurrentPosition(function(position) { > addMarker(position.coords.latitude, position.coords.longitude);}); > > function addMarker(lat,lng) { > var marker = new google.maps.Marker({ > position: {lat: lat, lng: lng}, > map: map > }); > } > > > > On Fri, Mar 1, 2019 at 4:50 PM Menghuy <menghuy...@gmail.com> wrote: > >> Hello, >> I tried to search on Internet a lot, but I couldn't find the answer. >> Is it possible to use geolocation with addmarker function in Google map >> api javascript? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "[deprecated] Google Maps JavaScript API v3. Please use the latest post." >> group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to google-maps-js-api-v3+unsubscr...@googlegroups.com. >> To post to this group, send email to >> google-maps-js-api-v3@googlegroups.com. >> Visit this group at https://groups.google.com/group/google-maps-js-api-v3 >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "[deprecated] Google Maps JavaScript API v3. Please use the latest post." > group. > To unsubscribe from this group and stop receiving emails from it, send an > email to google-maps-js-api-v3+unsubscr...@googlegroups.com. > To post to this group, send email to > google-maps-js-api-v3@googlegroups.com. > Visit this group at https://groups.google.com/group/google-maps-js-api-v3. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "[deprecated] Google Maps JavaScript API v3. Please use the latest post." group. To unsubscribe from this group and stop receiving emails from it, send an email to google-maps-js-api-v3+unsubscr...@googlegroups.com. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. Visit this group at https://groups.google.com/group/google-maps-js-api-v3. For more options, visit https://groups.google.com/d/optout.