Геолокация работает в разработке, а не в производстве

1

Я использую следующие сценарии для управления геолокацией,

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDfql15EdzdP0dJZ_r5A8IHs46KsJSIsbk&sensor=false"></script>
<script type="text/javascript">
    function checkGPS() {
        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("dvMap"), mapOptions);
                var marker = new google.maps.Marker({
                    position: LatLng,
                    map: map,
                    title: "Latitudine: " + p.coords.latitude + "<br />Longitudine: " + p.coords.longitude

                });
                document.getElementById('<%=latitudine.ClientID %>').value = p.coords.latitude;
                document.getElementById('<%=longitudine.ClientID %>').value = p.coords.longitude;
                window.AppInventor.setWebViewString("latitudine" + p.coords.latitude + "&longitudine" + p.coords.longitude)

                google.maps.event.addListener(marker, "click", function (e) {
                    var infoWindow = new google.maps.InfoWindow();
                    infoWindow.setContent(marker.title);
                    infoWindow.open(map, marker);
                });
            });


        } else {
            alert('Attenzione, il tuo browser non supporta la geolocalizzazione, non è possibile continuare.');
        }
    }
</script>

и следующий код, чтобы вызвать его

idDipendente = Session("idUtente")
idCliente = Session("rfCliente")
If idDipendente <> 0 Then
                    Dim dipendente As Utenti = db.Utenti.Where(Function(u) u.IdUtente = idDipendente).SingleOrDefault
                    Dim cliente As Clienti = db.Clienti.Where(Function(c) c.IdCliente = idCliente).SingleOrDefault
                    If cliente.Geolocalizzazione Then
                        If dipendente.Geolocalizzazione Then
                            ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "checkGPS", "checkGPS();", True)
                        End If
                    End If
                End If

Он отлично работает в разработке, он запрашивает разрешение на получение позиции, а затем использует координаты, но когда я публикую сайт, он полностью игнорирует эту функцию. Я использую хром. Любые подсказки/помощь будут высоко оценены, спасибо!

EDIT: сайт, на котором я публикую, использует https

Теги:
geolocation
coordinates

1 ответ

0
Лучший ответ

ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "checkGPS", "checkGPS();", True) не ClientScript.RegisterStartupScript(Me.GetType(), "checkGPS", "checkGPS();", True) в процессе производства, а ClientScript.RegisterStartupScript(Me.GetType(), "checkGPS", "checkGPS();", True).

Ещё вопросы

Сообщество Overcoder
Наверх
Меню