Get current location google maps aspx

Last Reply 6 hours ago By dharmendr

Posted 4 days ago

Hello. When i run my project i need to open a google map with the current location and a marker. But when i run it  start's in a diferent location and the marker is missing.

Here is my code

 <script type="text/javascript"
    <script type="text/javascript">
        if (navigator.geolocation) {
            navigator.geolocation.getCurrentPosition(function (p) {
                var LatLng = new google.maps.LatLng(p.coords.latitude, p.coords.longitude);
                var mapOptions = {
                    center: LatLng,
                    zoom: 13,
                    mapTypeId: google.maps.MapTypeId.ROADMAP
                var map = new google.maps.Map(document.getElementById("gmap"), mapOptions);
                var marker = new google.maps.Marker({
                    position: LatLng,
                    map: map,
                    title: "<div style = 'height:60px;width:200px'><b>Your location:</b><br />Latitude: " + p.coords.latitude + "<br />Longitude: " + p.coords.longitude
                google.maps.event.addListener(marker, "click", function (e) {
                    var infoWindow = new google.maps.InfoWindow();
          , marker);
        } else {
            alert('Geo Location feature is not supported in this browser.');


The reply you are looking for seems to be deleted or does not exist.