0

I have created an app with javascript that uses the current location and I have build the app on top of SharePoint. I am using the above code. If I run this app in Sharepoint I am not able to use the location, Location Blocked to protect your privacy I am not able to turn on location because it is readonly; enter image description here

I cannot use the location even in my phone I am not able to turn on the location. Why sharepoint sites wont be able to use location?

Please help me

<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?
sensor=false"></script>
<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("dvMap"), 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();
        infoWindow.setContent(marker.title);
        infoWindow.open(map, marker);
    });
});
} else {
alert('Geo Location feature is not supported in this browser.');
}
</script>
<div id="dvMap" style="width: 500px; height: 500px">
</div>

1 Answer 1

1

Try running your SP over HTTPS. If you don't have a valid certificate, you can create and add a one self-signed to test.

If you want to test with HTTP, try running your SP over localhost

Source: https://stackoverflow.com/questions/47257756/chrome-notifications-not-working-permission-not-requested

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.